Short Answer
sudo apt-get install python3-pip
sudo pip3 install MODULE_NAME
资料来源: Bharadwaj s comment
Long Answer
简短的答复只适用于较新的系统。 乌班图的一些版本的指挥为pip-3.2
:
sudo pip-3.2 install MODULE_NAME
If it doesn t work, this method should work for any Linux distro and supported version:
sudo apt-get install curl
curl https://bootstrap.pypa.io/get-pip.py | sudo python3
sudo pip3 install MODULE_NAME
如果没有<代码>curl,则使用<代码>wget。 如果没有<代码>sudo,改用<代码>root。 pip3 互不相干,如Pip-3。
大量的on包也要求开发公司包裹,这样也安装了:
sudo apt-get install python3-dev
Sources:
python installing packages with pip
Pip latest install
查询Tobu swer,如果你想得到一个更加升级的Sharma。
I want to add that using a virtual environment is usually the preferred way to develop a python application, so @felixyan answer is probably the best in an ideal world. But if you really want to install that package globally, or if need to test / use it frequently without activating a virtual environment, I suppose installing it as a global package is the way to go.