# 使用国内源安装Python包的示例代码
# 1. 安装包时指定国内源
# 以阿里云源为例
pip install 包名 -i https://mirrors.aliyun.com/pypi/simple/
# 2. 设置默认使用国内源
# 创建或编辑~/.pip/pip.conf文件(Windows系统为 %HOMEPATH%\pip\pip.ini)
# 添加以下内容:
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
# 3. 使用临时环境变量指定国内源
# 在命令行中执行以下命令:
pip install 包名 --index-url=https://mirrors.aliyun.com/pypi/simple/
# 4. 更新pip并指定国内源
pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/
解释说明:
上一篇:python 整数
下一篇:python 二维码
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站