PIP不显示正确的版本

发布于 2025-02-11 16:30:50 字数 1199 浏览 2 评论 0原文

我已经安装了Python3.8,并且从其源代码安装了Python3.4。

我想要pip == 19.1.1,因为它在python3.4中得到了支持。在我尝试更改其版本时安装PIP后,但是如您在附件图像中所看到的那样,它显示出不同的版本。

有没有一种方法将PIP与版本19.1.1一起使用?

先感谢您。

remus@remus-VirtualBox:~$ python3.4 --version
Python 3.4.0
remus@remus-VirtualBox:~$ sudo apt install python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pip is already the newest version (20.0.2-5ubuntu1.6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
remus@remus-VirtualBox:~$ pip install pip==19.1.1
Collecting pip==19.1.1
  Using cached pip-19.1.1-py2.py3-none-any.whl (1.4 MB)
Installing collected packages: pip
WARNING: The scripts pip, pip3 and pip3.8 are installed in '/home/remus/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-19.1.1
remus@remus-VirtualBox:~$ pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

显示错误的终端图像

os:ubuntu 20.04.4(focal)

I already had python3.8 installed and I installed python3.4 from its source code.

I wanted pip==19.1.1 as it is supported in python3.4. After installing pip when I tried changing its version but it was showing different version as you can see in the attached image.

Is there a way to use pip with version 19.1.1?

Thank you in advance.

remus@remus-VirtualBox:~$ python3.4 --version
Python 3.4.0
remus@remus-VirtualBox:~$ sudo apt install python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pip is already the newest version (20.0.2-5ubuntu1.6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
remus@remus-VirtualBox:~$ pip install pip==19.1.1
Collecting pip==19.1.1
  Using cached pip-19.1.1-py2.py3-none-any.whl (1.4 MB)
Installing collected packages: pip
WARNING: The scripts pip, pip3 and pip3.8 are installed in '/home/remus/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-19.1.1
remus@remus-VirtualBox:~$ pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

Terminal Image showing error

OS: UBUNTU 20.04.4(Focal)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

℉絮湮 2025-02-18 16:30:50

我强烈建议使用 venv conda 创建您的环境。这将使您不得不区分机器上的多个Python二进制文件。

也就是说,我认为您的问题可以通过使用正确的PIP启动PIP明确使用正确的Python版本来解决:

python3.4 -m pip --version

例如,我安装了两个不同的Python版本(对我感到羞耻!),这是我获得的输出:

generic@motorbrot:~$ python --version
Python 2.7.17
generic@motorbrot:~$ python -m pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
generic@motorbrot:~$ python3 --version
Python 3.6.9
generic@motorbrot:~$ python3 -m pip --version
pip 21.1.2 from /home/generic/.local/lib/python3.6/site-packages/pip (python 3.6)

I strongly recommend to use something like venv or conda to create your environments. That would allow you the hassle of having to distinguish multiple python binaries on your machine.

That said, I think your issue can be resolved by explicitly using the right python version by launching pip like this:

python3.4 -m pip --version

For example, I have two different python versions installed (shame on me!) and this is the output I get:

generic@motorbrot:~$ python --version
Python 2.7.17
generic@motorbrot:~$ python -m pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
generic@motorbrot:~$ python3 --version
Python 3.6.9
generic@motorbrot:~$ python3 -m pip --version
pip 21.1.2 from /home/generic/.local/lib/python3.6/site-packages/pip (python 3.6)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文