您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關python中安裝pip工具的方法,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
下載pip
地址:https://pypi.python.org/pypi/pip#downloads
注意選擇tar.gz壓縮包,目前最新版本為19.1.1,這里選擇的版本是:pip-19.1.1.tar.gz (md5, pgp)
點擊:下載
2. 解壓安裝
解壓下載的壓縮包至工作目錄下(如D:\),打開Windows cmd,運行如下命令進入解壓后的pip目錄
cd /d D:\pip-19.1.1
使用如下命令進行安裝
python setup.py install
3. 添加環(huán)境變量
添加windows系統(tǒng)環(huán)境變量,與安裝python時添加的方法一樣
如我的python目錄是:F:\Python27\;
則添加如下2個目錄到系統(tǒng)環(huán)境變量里:F:\Python27\;F:\Python27\Scripts;
4. pip常用命令
安裝成功后,重新進入CMD后運行pip,可以看到幫助文檔:
Usage: pip <command> [options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. config Manage local and global configuration. search Search PyPI for packages. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. help Show help for commands. General Options: -h, --help Show help. --isolated Run pip in an isolated mode, ignoring environment variables and user configuration. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels). --log <path> Path to a verbose appending log. --proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port. --retries <retries> Maximum number of retries each connection should attempt (default 5 times). --timeout <sec> Set the socket timeout (default 15 seconds). --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort. --trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS. --cert <path> Path to alternate CA bundle. --client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format. --cache-dir <dir> Store the cache data in <dir>. --no-cache-dir Disable the cache. --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index. --no-color Suppress colored output
pip常用命令如下:
#安裝包 pip install xxx #升級包,可以使用-U 或者 --upgrade pip install -U xxx #卸載包 pip uninstall xxx #列出已安裝的包 pip list
關于python中安裝pip工具的方法就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。