存在python3 pip时,针对python2的pip [英] Pip for python2 while python3 pip exists
问题描述
我的系统中同时有python2
和python3
.但是当我尝试:
I have both python2
and python3
in my system. But when I try :
python -m pip install sklearn
bash
显示:
/usr/bin/python:没有名为pip的模块
/usr/bin/python: No module named pip
还有
pip --version
收益:
/usr/lib/python3/dist-packages/pip(python 3.8)中的pip 20.0.2
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
Python版本为Python 2.7.18
和Python 3.8.2
.
如何通过设置两个点子来纠正此错误?
Python versions are Python 2.7.18
and Python 3.8.2
.
How to correct this error by having two pip versions?
此是类似的问题,但没有解决问题.
This is a similar question, but did not solve the issue.
操作系统是Ubuntu.
OS is Ubuntu.
推荐答案
感谢香港男孩 以下工作,它将为指定的python版本显式安装pip:
Thanks to HK boy The following works, it installs pip explicitly for the python version specified :
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
我之前已经有pip3
,所以要安装python3的软件包,pip3 install <package>
就足够了.
I already had pip3
before hand, so to install packages for python3, pip3 install <package>
is enough.
这篇关于存在python3 pip时,针对python2的pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!