【Python学习】pypi 软件源-pip
国内源:
anaconda配置镜像
Mac and Linux
1
2
|
conda config --add channels https: //mirrors .tuna.tsinghua.edu.cn /anaconda/pkgs/free/ conda config -- set show_channel_urls yes |
Windows
windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下
1
2
|
[global] index-url = https: //pypi.tuna.tsinghua.edu.cn/simple |
pip配置镜像
Linux
修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:
1
2
|
[global] index-url = https: //pypi.tuna.tsinghua.edu.cn/simple |
Windows
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下
1
2
|
[global] index-url = https: //pypi.tuna.tsinghua.edu.cn/simple |
请注意:一定是在你个人用户文件夹下先建立pip文件夹,在建立pip.ini文件,不是直接把pip.ini文件放在C:\Users\xx\下
pip临时镜像
临时使用:
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent,这样就会从清华这边的镜像去安装gevent库。
当遇到pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Read timed out.
比如我使用 :easy_install pip 就会出现这个超时,建议更换成豆瓣源使用 -i https://pypi.doubanio.com/simple

pypi 软件源 如何使用? pip install -i http://xxxxxx --trusted-host xxxxxxx PACKAGE1 PACKAGE2 ... 或者修改默认配置, 编辑 ~/.pip/pip.conf [global] # 从官方源 https://pypi.python.org 同步, 10分钟同步一次 index-url = http://xxxxxx # 内部私有pypi服务 extra-index-url = http://xxxxxx [install] trusted-host = xxxxxx [list] # 解决pip list时显示警告问题 format=columns 如果你想上传包到内部pypi服务 pip install pypi-uploader pypiupload packages ${package_path} -i http://xxxxxx
作者:gtea
博客地址:https://www.cnblogs.com/gtea
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!