[英]How to install package using pip when you have 2 Python versions
I have 2
anaconda in my system: one with python 2.7
& and another with python 3.5
. 我的系统中有2
anaconda: one with python 2.7
&, another with python 3.5
。
My command prompt is showing python version as 2.7
. 我的命令提示符显示python版本为2.7
。
I need to install one package for Python 3.5
using pip
only,not conda install. 我只需要使用pip
为Python 3.5
安装一个软件包,而不是conda install。 I installed it using pip. 我使用pip安装了它。 It's showing installed successfully, but I'm not able to import it in Anaconda with Python 3.5 . 显示已成功安装,但无法使用Python 3.5将其导入Anaconda 。
My python 2.7 path is given in path environmental variable. 我的python 2.7路径在路径环境变量中给出。 Can you suggest me how to install it using pip install for python 3.5
? 您能建议我如何使用适用于python 3.5
pip install进行安装吗?
I don't have python 3 installed in my system. 我的系统中没有安装python 3。 I think I have anaconda 3.5 environment in my system. 我想我的系统中有anaconda 3.5环境。 Please refer the screen shot. 请参考屏幕截图。 Also I can't able to install python 3.5 in my system 我也无法在系统中安装python 3.5
To install a package in specific version, try this: 要安装特定版本的软件包,请尝试以下操作:
$ python-3.5 -m pip install <pkg-name>
Assuming you mean that you have two conda
environments, go to a Anaconda command prompt and activate the Python 3.5 environment. 假设您有两个conda
环境,请转到Anaconda命令提示符并激活Python 3.5环境。 Then, if pip
is not installed, do: 然后,如果未安装pip
,请执行以下操作:
conda install pip
Then, you should be able to run 然后,您应该可以运行
pip install <package>
to install in to Python 3.5 provided that you are in the Python 3.5 environment. 如果您处于Python 3.5环境中,则可以安装到Python 3.5中。
If you don't have a Python 3.5 environment yet, simply do 如果您还没有Python 3.5环境,只需执行
conda create --name py35 python=3.5
followed by 其次是
activate py35 (Windows)
source activate py35 (Linux or macOS)
You can use: 您可以使用:
pip install --install-option="--prefix=$PATH_PREFIX" <package_name>
or 要么
pip install -t <direct directory> <package_name>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.