简体   繁体   English

有2个Python版本时如何使用pip安装软件包

[英]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. 我只需要使用pipPython 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: 要安装特定版本的软件包,请尝试以下操作:

A specific version of python: 特定版本的python:

$ 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.

相关问题 使用pip安装软件包以获取python的更新版本 - Install packages using pip for updated versions of python 如何使用 Python -m pip install 在 Dockerfile 中安装包 - How to install package in Dockerfile by using Python -m pip install 使用Python诗时如何安装可选的package? - How do you install an optional package when using Python Poetry? 如何将安装包安装到不同版本的Python中 - How to pip install packages into different versions of Python 如何安装与不同版本的Python相关的pip - How to install pip associated to different versions of Python 在Windows上使用pip安装Scipy python软件包时出现错误 - error when using pip to install Scipy python package on windows 当我的计算机上有 Python 2、Python 3 和 Anaconda 时,如何控制将包安装到哪个 Python 发行版? - How can I control which Python distribution to pip install a package to when I have Python 2, Python 3, and Anaconda on my computer? 在 Python 的 Pip 中,如何搜索与版本模式匹配的 package 的所有可能版本? - In Python's Pip, how can you search for all possible versions of a package, which match a version pattern? 如何在python控制台中使用pip安装本地包 - How to install a local package using pip in python console 如何使用PIP安装不同名称的python包 - How to install python package with a different name using PIP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM