pip - How to install packages in different version of python? -
i have macbook pro came pre-installed python 2.7. later installed python3 , ipython notebook. installed pip install packages, , able install packages , run program python 3. however, project need run code in python 2.7, , not sure how install in python 2.7 folder.
i tried using pip installing packages 2.7, kept giving error saying package exists. when check version of python using --version, see 2 pythons installed. however, when check pip , pip3, both seem in th same folder.
any tips on how install packages in python 2.7, without making changes 3.3? using python3 , ipython notebooks project.
viveks-mbp:~ vivekyadav$ pip /library/frameworks/python.framework/versions/3.3/bin/pip viveks-mbp:~ vivekyadav$ pip3 /library/frameworks/python.framework/versions/3.3/bin/pip3
viveks-mbp:~ vivekyadav$ python /usr/bin/python viveks-mbp:~ vivekyadav$ python3 /library/frameworks/python.framework/versions/3.3/bin/python3
you can use virtualenv
create kind of sandbox.
$ virtualenv <work-directory> $ source <work-directory>/bin/activate
the last command initiate virtual environment, totally isolated system. every pip
command install package inside directory.
but have run application inside virtual environment too.
Comments
Post a Comment