简体   繁体   中英

pip not showing correct version

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)

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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