Linux 下安装Python 以及pip包的安装以及相关命令

Python 2:

sudo dnf upgrade python-setuptools
sudo dnf install python-pip python-wheel
Python 3: sudo dnf install python3 python3-wheel  #python3 自带pip

Pip命令:

pip install SomePackage      #安装某个包(最新版本)
pip install somepackage==1.4    #安装1.4版本的某个包
pip show --files SomePackage    #查看安装的包
pip install --upgrade SomePackage  #更新某一个包
pip uninstall SomePackage      #卸载某一个包
pip install SomeProject>=1,<2    #安装两个版本之间的包
pip install 'SomeProject~=1.4.2'  #安装一个接近版本的包
pip install --index-url http://my.package.repo/simple/ SomeProject  #url安装
#同时对另外一个安装
pip install --extra-index-url http://my.package.repo/simple SomeProject
 
#local src tree 安装
pip install -e 或者
pip install
pip install ./downloads/SomeProject-1.0.4.tar.gz #本地存档安装
#从本地目录安装(3)
pip install --no-index --find-links=file:///local/dir/ SomeProject
pip install --no-index --find-links=/local/dir/ SomeProject
pip install --no-index --find-links=relative/dir/ SomeProject
 
pip install --pre SomeProject    #预安装 按条件安装。
$ pip install SomePackage[PDF] $ pip install SomePackage[PDF]==3.0 $ pip install -e .[PDF]==3.0 # editable project in current directory

主要来源:

https://packaging.python.org/en/latest/install_requirements_linux/#installing-pip-setuptools-wheel-with-linux-package-managers

https://packaging.python.org/en/latest/installing/#installing-from-vcs

Python 的详细介绍请点这里
Python 的下载地址请点这里

猜你喜欢

转载自www.linuxidc.com/Linux/2016-05/131090.htm