在Ubuntu16.04中,我一直是用pip来安装Python所需的包的,今天我用Python3时,报错:提示说包不存在!!!我在想,这是为什么呢?我不是已经用pip安装过包了吗,为什么在Python3中提示没有安装包???
I ran into this issue myself recently and found that I wasn't getting the right pip for Python 3, on my Linux system that also has Python 2.
First you must ensure that you have installed pip for your python version:
For Python 2:
sudo apt-get install python-pipFor Python 3:
sudo apt-get install python3-pipThen to install packages for one version of Python or the other, simply use the following for Python 2:
pip install <package>or for Python 3:
pip3 install <package>pip is also a python package. So the easiest way to install modules to a specific python version would be below
python2.7 /usr/bin/pip install fooor
python2.7 -m pip install foo