[英]How to uninstall Python 2.7 and keep Python 3.4?
而不是使用:
pip install <module>
您可以使用以下内容安装module
,该module
会将其安装到python-3.x
(只要python
指向您的PATH
python-3.x
目录):
python -m pip install <module>
或者,您可以使用pip3
将其直接安装到python-3.x
。
要使用pip3
,您需要导航到:
C:\path\to\python\Scripts\pip3
然后运行它:
pip3 install <module>
它将installed
到python-3.x
而不是python-2.x
。
如果您需要卸载 Python,只需使用 Windows 的添加/删除程序并运行该特定版本的卸载程序。
更高版本的 Python 包括 PyLauncher (py.exe) 并将其安装到C:\\Windows
,它始终位于路径中。 使用它来控制运行哪个 Python 以及运行哪个 pip(如果您安装了多个)。 如果您使用它,您将不必将特定版本的 Python 或其脚本目录(pip.exe 所在的位置)添加到您的路径中。
例子:
py -3 -m pip install <package> # Use latest Python 3 installed.
py -2 -m pip install <package> # Use latest Python 2.
py -3.3 # Run Python 3.3
py -2.7-32 # Run 32-Python 2.7 on a 64-bit OS.
py # Run default Python (usually latest 3.x)
PY_PYTHON
环境变量可以覆盖默认值。
另请参阅: 适用于 Windows 的 Python 启动器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.