简体   繁体   English

如何为特定的python版本安装软件包

[英]How to install a package for specific python version

I have two versions of python (3 and 2) and Python 2 is the default one, I want to install a specific package only for Python 3, 我有两个版本的python(3和2),而Python 2是默认版本,我只想为Python 3安装特定的软件包,

I am using windows 7 我正在使用Windows 7

whenever i use pip install, it is installing python 2 package 每当我使用pip install时,它正在安装python 2软件包

How to specify which python version for pio install 如何指定要安装pio的python版本

python -m pip install package

python3 -m pip install package

This is how you would do it using pip for v2 and v4 respectively. 这是分别使用pip v2和v4的方式。

On windows you can use the following commands in command line: 在Windows上,您可以在命令行中使用以下命令:

# For Python 2
pip2 install package_name
# For Python 3
pip3 install package_name

Alternate way: 替代方式:

# For Python 2
py -2 -m pip install package_name
# For Python 3
py -3 -m pip install package_name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM