食品包装设计网站,模板网站建设报价,塑料袋销售做哪个网站推广好,承德网媒【Python】pip安装加速#xff1a;使用国内镜像源
零、使用命令行设置
设置全局镜像源
随便使用下面任一命令即可#xff01;
阿里云#xff1a;
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/豆瓣#xff1a;
pip config set global.in…【Python】pip安装加速使用国内镜像源
零、使用命令行设置
设置全局镜像源
随便使用下面任一命令即可
阿里云
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/豆瓣
pip config set global.index-url https://pypi.douban.com/simple/清华大学
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/中国科学技术大学
pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/遇到的问题信任镜像源
最新版的pip要求必须使用https如果源不是https协议的会报如下错误
WARNING: The repository located at … is not a trusted or secure host and is being ignored.
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommen
d you use HTTPS instead, otherwise you may silence this warning and allow it anyway with --trusted-host mirrors.aliyun.com.
ERROR: Could not find a version that satisfies the requirement requests (from versions: none)
ERROR: No matching distribution found for requests
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommen
d you use HTTPS instead, otherwise you may silence this warning and allow it anyway with --trusted-host mirrors.aliyun.com.
WARNING: There was an error checking the latest version of pip.解决方案一切换为https的源推荐
一般在链接中把http替换成https即可或者找对应的https源。
解决方案二临时信任
可以在命令行后加上--trusted-host参数例如
pip install -i http://mirrors.aliyun.com/pypi/simple/ 依赖参数 --trusted-host mirrors.aliyun.com壹、使用文件设置
Windows上按WindowsR键打开运行输入%userprofile%打开个人文件夹在个人文件夹中新建.pip目录在目录中新建文本文档并改名为pip.conf写入如下内容
阿里云http
[global]
index-url http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-hostmirrors.aliyun.com阿里云https
[global]
index-url https://mirrors.aliyun.com/pypi/simple/其他的源也是类似的把链接改一下即可
豆瓣https://pypi.douban.com/simple/清华大学https://pypi.tuna.tsinghua.edu.cn/simple/中国科学技术大学https://pypi.mirrors.ustc.edu.cn/simple/
叁、参考文档
国内pip源提示“not a trusted or secure host”解决方案pip源提示“not a trusted or secure host” 解决【Python】已完美解决WARNING: The repository located at mirrors .aliyun.com is not a trusted or secure hostpip使用国内镜像源附加全局修改