標籤:pypy 檔案 環境變數 net 安裝 指定 目錄 rip file
Python有兩個著名的包管理工具easy_install.py和pip。在Python2.7的安裝包中,easy_install.py是預設安裝的,而pip需要我們手動安裝。
pip可以運行在Unix/Linux, OS X, and Windows平台上,支援CPython versions 2.6, 2.7, 3.1, 3.2, 3.3, 3.4 and also pypy.
【Download】
下載pip的安裝包get-pip.py,:https://pip.pypa.io/en/latest/installing.html#id7
【INSTALL】
1. windows上執行如下命令:
1 python get-pip.py
2. 安裝的後的驗證:
執行完成後,在python的安裝目錄下的Scripts子目錄下,可以看到pip.exe、pip2.7.exe、pip2.exe等,這就表示pip安裝成功了。
注意:要想能在命令列上直接運行pip程式,需要scripts這個目錄加入到環境變數PATH中。
pip安裝的時候還可以使用安裝選項進行安裝,比如指定get-pip.py所在的位置:
[python] view plain copy
python get-pip.py --no-index --find-links=c:\downloads
[python] view plain copypython get-pip.py --no-index --find-links=c:\downloads
View Code
3. Linux下的安裝
#On Debian and Ubuntu:sudo apt-get install python-pip #On Fedorasudo yum install python-pip
4. 升級Pip
#On Linux or OS Xpip install -U pip #On Windows :python -m pip install -U pip
【USage】
#Install a package from PyPI:pip install SomePackage##安裝特定版本的package,通過使用==, >=, <=, >, <來指定一個版本號碼。pip install ‘Markdown<2.0‘pip install ‘Markdown>2.0,<2.0.3
##果有requirement的話,直接就可以安裝所有的了。
pip install -r requirements.txt
##Uninstall a package:pip uninstall SomePackage ##Upgrade a package:pip install --upgrade SomePackage ##Show what files were installed:pip show --files SomePackage##List what packages are outdated:pip list --outdated##例如:列出列出selunium包的所有檔案pip show --files selenim
執行結果是列出selunium包的所有檔案執行結果是列出selunium包的所有檔案
python包管理之Pip安裝及使用