pip 如何删除/取消国内镜像源
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
posted on 2020-09-19 10:48 缺陷催生进化,完美预示终结 阅读(9209) 评论(0) 编辑 收藏 举报