pip config unset global.index-url
其他常用pip命令
- install
安裝包
- 無參數, 直接從pypi中查找下載
>> pip install Django # 安裝最新穩定的版本,可能會將某些依賴的版本更新為符合的版本。所以要可能的話,項目中版本號全部都限制好。 >> pip install Django==3.0 # 安裝3.0版本 >> pip install Django>=3.0 # 安裝3.0及以上的版本 >> pip install Django~=3.0 # 安裝3.0小版本匹配即安裝3.0.x中最新穩定的版本
- -e 安裝可編輯的包。不同項目,但是一個項目依賴時使用。
>> pip install -e 本地目錄 >> pip install -e git+https://github.com/django/django.git#egg=django >> pip install -e git+ssh://git@github.com:django/django.git#egg=django
- -r 不解釋,懂得都懂。通過requirements文件可控地安裝很多依賴。
>> pip install -r requirements.txt
- -t 安裝到指定位置
>> pip install -t 位置目錄
- 無參數, 直接從pypi中查找下載
- download
下載包 把指定的包的二進制文件下載到指定位置
>> pip download django -d ${DEST}
- 1
- uninstall
刪除包
>> pip uninstall Django
- 1
- freeze
-r, --requirement <file> Use the order in the given requirements file and its comments when generating output. This option can be used multiple times. -f, --find-links <url> URL for finding packages, which will be added to the output. -l, --local If in a virtualenv that has global access, do not output globally-installed packages. --user Only output packages installed in user-site. --path <path> Restrict to the specified installation path for listing packages (can be used multiple times). --all Do not skip these packages in the output: setuptools, pip, distribute, wheel --exclude-editable Exclude editable package from output.
-
>> pip freeze asgiref==3.2.10 Django==3.0.8 pytz==2020.1 sqlparse==0.3.1
-
list
Usage:
pip3 list [options] Description: List installed packages, including editables. Packages are listed in a case-insensitive sorted order. List Options: -o, --outdated List outdated packages # 列出過期 -u, --uptodate List uptodate packages # 列出最新 -e, --editable List editable projects. # 列出可編輯 -l, --local If in a virtualenv that has global access, do not list globally-installed packages. # 列出安裝在虛擬環境中的 --user Only output packages installed in user-site. # 安裝在用戶目錄下的 --path <path> Restrict to the specified installation path for listing packages (can be used multiple times). --pre Include pre-release and development versions. By default, pip only finds stable versions. --format <list_format> Select the output format among: columns (default), freeze, or json --not-required List packages that are not dependencies of installed packages. --exclude-editable Exclude editable package from output. --include-editable Include editable package from output.
- show
展示指定的已安裝的包
>> pip show Django Name: Django Version: 3.0.8 Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design. Home-page: https://www.djangoproject.com/ Author: Django Software Foundation Author-email: foundation@djangoproject.com License: BSD Location: /home/ling/env/lib/python3.8/site-packages Requires: sqlparse, asgiref, pytz Required-by:
- check
檢查某個包的依賴是否合適
>> pip check Django launchpadlib 1.10.13 requires testresources, which is not installed. flask-security-too 3.4.2 requires email-validator, which is not installed. awscli 1.18.66 has requirement botocore==1.16.16, but you have botocore 1.16.6.
- config
用來配置本地和全局的配置
>> pip config list --[user|global] # 列出用戶|全局的設置 >> pip config get global.index-url # 得到這key對應的value >> https://mirrors.aliyun.com/pypi/simple/ >> pip config set key value >> pip config unset key
- search
在pypi里搜索相關包
>> pip search flask Flask-SimpleMDE (0.3.0) - Flask-SimpleMDE - a Flask extension for SimpleMDE Flask-Pure (0.5) - Flask-Pure - a Flask extension for Pure.css Flask-OrientDB (0.1) - A Flask extension for using OrientDB with Flask Flask-ElasticUtils (0.1.7) - ElasticUtils for Flask Flask-Waitress (0.0.1) - Flask Waitress sockjs-flask (0.3) - SockJs for Flask Flask-Stripe (0.1.0) - Flask-Stripe Flask-PubSub (0.1.0) - Flask-PubSub ...
- cache
管理pip的本地緩存
- dir 緩存目錄
>> pip cache dir /home/stephen-ling/,cache/pip
- info 緩存的一些信息
>> pip cache info Location: /home/stephen-ling/.cache/pip/wheels Size: 0 bytes Number of wheels: 0
- list 列出當前緩存的包
- purge 清除緩存
- remove 刪除對應的緩存
- dir 緩存目錄
- wheel
打包成二進制文件
>> pip wheel Django
- hash
計算一個包的hash值
- completion
- debug
提供一些debug有用的信息, 不知道可以怎么用。
- help
查詢幫助
>> pip help
源文鏈接:http://blog.csdn.net/qq_35104586/article/details/107441178