[英]How to install pip for python3.7 only?
I have python3.7 and I want to install pip.我有 python3.7,我想安装 pip。 However when I do the following:但是,当我执行以下操作时:
sudo apt install python3-pip
It seems to download python version 3.6 and pip for that .这似乎是下载Python版本3.6和PIP了点。 Is there a way to not download python3.6 and just download pip for python3.7?有没有办法不下载python3.6而只下载python3.7的pip? It seems rather strange that pip is download a whole other package. pip 下载一个完整的其他包似乎很奇怪。
Download get-pip file下载 get-pip 文件
$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Install pip for python3.7为python3.7安装pip
$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
并使用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如果您检查apt show python3-pip
输出,您会看到它取决于python3:any (>= 3.4~)
所以它并没有严格说我需要 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.我假设您没有使用apt
安装 python3.7,因此 apt 无法识别您有 python3 并尝试为您安装它。
尝试这个。
python3.7 -m pip install pip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.