gpt4 book ai didi

python - 更改 pip 指向的 Python 版本

转载 作者:行者123 更新时间:2023-12-04 12:25:53 34 4
gpt4 key购买 nike

我在 Ubuntu 16.04 上使用 python2.7 和 python3.5。将 pip 升级到 v10 后,我无法再使用 pip 为 python2.7 安装软件包。

如何将 pip 更改为指向 python2.7?

$ pip -V
pip 10.0.0 from /home/username/.local/lib/python3.5/site-packages/pip (python 3.5)

$ pip3 -V
pip 10.0.0 from /home/username/.local/lib/python3.5/site-packages/pip (python 3.5)

$ which python
/usr/bin/python

$ which python3
/usr/bin/python3

$ python -V
Python 2.7.12

$ python3 -V
Python 3.5.2

$ which pip
/usr/local/bin/pip

$ which pip3
/usr/local/bin/pip3

$ python3 -m pip install some_module
$ python -m pip install some_module
python/python3 -m pip install some_module两者都安装到 python 3.5。

使用 Anaconda 不是一种选择。

最佳答案

有一个非常相似的问题。强制重新安装pip导致pip指向回python 2.7

sudo python -m pip install -U --force-reinstall pip

关于python - 更改 pip 指向的 Python 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49840543/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com