当前位置: 首页 > article >正文

为pip永久性添加国内镜像安装源

国内安装很多大的包都会发现速度非常慢,这是因为pip默认的安装源一般都是在国外的,通常只有几十K的速度,所以安装个小包时没有感觉,但安装大包时就很明显了。

1、如果你只是想临时性的换一个安装源,那么用-i选项临时指定本次安装的安装源则可:

pip install labelme -i https://pypi.tuna.tsinghua.edu.cn/simple

2、如果你想永久性的添加国内镜像安装源

2.1、用pip -v config list命令可以看到site变量在/usr/pip.conf文件中

sudo pip -v config list
For variant 'global', will try loading '/etc/xdg/pip/pip.conf'
For variant 'global', will try loading '/etc/pip.conf'
For variant 'user', will try loading '/root/.pip/pip.conf'
For variant 'user', will try loading '/root/.config/pip/pip.conf'
For variant 'site', will try loading '/usr/pip.conf'

2.2、添加以下内容到上一章节里’site’指定的文件/usr/pip.conf中

pip首先从index-url指定的源中去安装,在index-url指定的源中找不到安装包的话,会从extra-index-url指定的源中去安装。加上trusted-host和ssl_verfy: false可以减少很多安装源安全验证性的问题,会带来很多便利性,当然也可能会带来安全的风险。

[global]
index-url = https://pypi.mirrors.ustc.edu.cn/simple/
extra-index-url = https://pypi.tuna.tsinghua.edu.cn/simple
                  https://mirrors.aliyun.com/pypi/simple
                  hppts://pypi.douban.com/simple
                  
[install]
trusted-host=
        pypi.tuna.tsinghua.edu.cn
        mirrors.aliyun.com
        pypi.douban.com
        pypi.mirrors.ustc.edu.cn

ssl_verify: false

3、下面是一些推荐的速度快,安装包新的国内镜像源:

名字URL
中国科技大学https://pypi.mirrors.ustc.edu.cn/simple/
清华大学https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云https://mirrors.aliyun.com/pypi/simple/
豆瓣https://pypi.douban.com/simple/

http://www.kler.cn/news/10554.html

相关文章:

  • 44.节流与防抖
  • JavaScript函数
  • android ndk 编译 libevent
  • setInterval 让它刚进页面时执行一次,然后根据设置的间隔时间执行;clearInterval清除setInterval。
  • webgl-根据鼠标点击而移动
  • linux对动态库的搜索知识梳理
  • 推荐 ChatGpt 平替介绍文章
  • TensorFlow 机器学习秘籍第二版:6~8
  • 常见网络协议汇总(一)
  • 前端手写综合考题
  • DS-NeRF代码
  • 【SpringMVC】SpringMVC注解式开发
  • ChatGPT实现用C语言写一个学生成绩管理系统
  • 阻塞/非阻塞、同步/异步、五种IO模型
  • SpringBoot基础配置
  • Spring相关概念
  • 2.28、共享内存(1)
  • springboot如何优雅的打印项目日志
  • 蹭ChatGPT热点有风险,昆仑万维蹭热点被发监管函
  • Vite打包后直接使用浏览器打开,显示空白问题
  • 题解,git的使用,MySQL与JDBC的使用(上)
  • NDK RTMP直播客户端二
  • Metasploit高级技术【第十章】
  • C++篇 ---- 命名空间namespace
  • 华为MatePad有什么好用的软件?
  • 用SSH登陆Centos系统时,命令行最前面显示“的提示符[root@www myapp]”是什么意思?
  • 【博学谷学习记录】超强总结,用心分享丨人工智能 AI项目 统计语言模型之HMM初步学习总结
  • 基于Python实现的深度学习技术在水文水质领域应用
  • Java多线程:定时器Timer
  • C++之入门之缺省参数函数重载引用