什么网站做展板的多,网站正能量就是一打开全是的,网站设计分析报告,网站建设调研背景一、简介
pip是python的一个软件包管理工具#xff0c;同yum#xff0c;apt作用一致#xff0c;pip有两种使用方式#xff1a;pip模块和pip命令#xff0c;示例如下#xff1a;
python -m pip install package
pip install package二、命令行详解
python -m pip --hel…一、简介
pip是python的一个软件包管理工具同yumapt作用一致pip有两种使用方式pip模块和pip命令示例如下
python -m pip install package
pip install package二、命令行详解
python -m pip --help
C:\Users\love1python -m pip --helpUsage:C:\Users\love1\AppData\Local\Programs\Python\Python311\python.exe -m pip command [options]Commands:install Install packages.download Download packages.uninstall Uninstall packages.freeze Output installed packages in requirements format.inspect Inspect the python environment.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.cache Inspect and manage pips wheel cache.index Inspect information available from package indexes.wheel Build wheels from your requirements.hash Compute hashes of package archives.completion A helper command used for command completion.debug Show information useful for debugging.help Show help for commands.1、安装pip
get-pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # 下载安装脚本
python get-pip.py # 运行安装脚本注意 用哪个版本的 Python 运行安装脚本pip 就被关联到哪个版本如果是 Python3 则执行以下命令
python3 get-pip.py # 运行安装脚本ensurepip
python -m ensurepip
python -m ensurepip --upgrade # 安装最新版本的详见安装链接
2、配置
pip通过三种方式来配置相关配置项
command line options 命令行选项environment variables 环境变量configuration files 配置文件
配置文件的格式是INI格式
environment variables 环境变量 pip可以通过环境变量来替代命令行选项格式为PIP_UPPER_LONG_NAME用_代替-示例如下
PIP_TIMEOUT60 同 --timeout60
PIP_FIND_LINKShttp://mirror1.example.com http://mirror2.example.com
同
--find-linkshttp://mirror1.example.com --find-linkshttp://mirror2.example.com
PIP_VERBOSE3 同 pip install -vvvconfiguration files 有三种层级的配置文件可以用
global 系统范围的配置文件所有用户共享 该配置文件存放于XDG_CONFIG_DIRS环境变量所代表的目录下常见目录为/etc/xdg/pip/pip.conf或者/etc/pip.confuser 用户范围的配置文件 XDG_CONFIG_HOME环境变量所代表的配置文件常见目录为$HOME/.config/pip/pip.conf或者$HOME/.pip/pip.confsite 环境范围内的配置文件 $VIRTUAL_ENV/pip.conf
PIP_CONFIG_FILE环境变量也可以指定配置文件路径但是如果该值被设置为os.devnull则将禁用所有的配置文件
加载顺序 loading order
GlobalUserSitePIP_CONFIG_FILE, if given pip会按照上述顺序加载配置文件但是后加载的配置文件会覆盖前面加载的配置文件如果配置文件中有相同项配置的话。
在配置文件中按照命令来区分 示例如下
[global]
find-links http://download.example.com
timeout 60[freeze]
timeout 10[install]
find-links http://mirror1.example.comhttp://mirror2.example.comtrusted-host mirror1.example.commirror2.example.com上述按照命令区分的含义是当执行pip freeze的时候timeout 的值是10而不是60当执行pip install 的时候timeout 的值是60但是find-links的值是 http://mirror1.example.com http://mirror2.example.com
生效优先级 命令行选项环境变量PIP_CONFIG_FILE配置文件site配置文件user 配置文件global配置文件 在配置文件中 [command] host bar [global] host 即 –hostfoo 会覆盖 PIP_HOSTfoo PIP_HOSTfoo 会覆盖配置文件中的[global] host foo
详见配置文件