Installing package in Python

2019-08-13 01:23发布

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.

2条回答
你好瞎i
2楼-- · 2019-08-13 01:49

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
查看更多
地球回转人心会变
3楼-- · 2019-08-13 01:57

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.

查看更多
登录 后发表回答