问题
I have in my laptop installed both python 2.7 and python 3.5 . When I install a package and use for example:
pip install thunder-python
or
easy_install thunder
in command prompt the packages are installed for python 3.5. How can I install the packages in order to use them in python 2.7? I am using Windows 10.
回答1:
Add C:\Python27\Scripts
to your PATH
in system settings, and you will be able to run:
pip3 thunder
to install packages for Python 3.x
and
pip2 thunder
or pip2.7 thunder
to install packages for Python 2.7.
Without modifying PATH
, for Python 2.7 you can run the command directly:
C:\Python27\Scripts\pip thunder
.
After modifying the PATH
pip
command will be called from the directory found first, so if you add Python2.7 directory to the end you'll get pip
to run for Python3, if you add Python2.7 to the start, you'll get pip
to run for Python2.7.
回答2:
How about using pyenv? If you use it, you can change and switch version and install package like this.
$ pyenv local 2.7.X
$ pip install thunder-python
after that
$ pyenv local 3.5.X
$ pip install thunder-python
来源:https://stackoverflow.com/questions/34808902/installing-package-in-python