简体   繁体   中英

How to install pip for python3.7 only?

I have python3.7 and I want to install pip. However when I do the following:

sudo apt install python3-pip

It seems to download python version 3.6 and pip for that . Is there a way to not download python3.6 and just download pip for python3.7? It seems rather strange that pip is download a whole other package.

Download get-pip file

$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Install pip for python3.7

$python3.7 get-pip.py

Check versions for both

$python3.7 -V && pip3 -V
Output:
Python 3.7.3
pip 19.1.1 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)

Another way to do it is to run:

apt install -y python3-pip

and use python3.7 -m pip

if you check apt show python3-pip output you see it depends on python3:any (>= 3.4~) so it doesn't strictly say I need python3.6

I assume that you didn't install python3.7 using apt so as a result apt doesn't recognize that you have python3 and it tries to install it for you.

尝试这个。

python3.7 -m pip install pip

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