Pycharm 配置 Conda,国内使用正确的镜像源地址

您所在的位置:网站首页 清华源pycharm Pycharm 配置 Conda,国内使用正确的镜像源地址

Pycharm 配置 Conda,国内使用正确的镜像源地址

2024-07-15 18:16| 来源: 网络整理| 查看: 265

开始使用 Pycharm,搭配Conda做包管理,按照网上教程使用过程中发现镜像源不管是阿里的还是清华的都会有404异常,花了点时间找到正确的配置方式。记录一下备忘。

参考链接:

https://blog.csdn.net/weixin_42425256/article/details/105099769https://blog.csdn.net/weixin_39918690/article/details/110606097https://www.cnblogs.com/tianlang25/p/12433025.htmlhttps://www.cnblogs.com/zengming/p/12057656.html

问题出在镜像源的链接上,网上教程大部分是类似这种:

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

但其实打开链接后会发现下面还有一层,如下: 在这里插入图片描述 这里面是各种平台,正确的链接应该再加上对应的平台。例如mac系统64位的配置是这样:

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/osx-64/ https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/osx-64/

windows 64位系统是这样:

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64/ https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/

贴一下我的配置,据说上海交大源比较全,因此我的配置中交大源优先 。(2023.03.01更新,交大源有异常,用清华的)

/Users/xxx/.condarc

show_channel_urls: true channels: # - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/osx-64/ # - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/osx-64/ # - https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/conda-forge/osx-64/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/osx-64/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/osx-64/ ssl_verify: true

某些包通过Conda下不到的,再通过pip install -i 指定临时镜像安装。例如:

pip install -i http://mirrors.aliyun.com/pypi/simple opencv-contrib-python==3.4.2.17 --trusted-host mirrors.aliyun.com

嫌麻烦也可以永久修改配置镜像源,如下:

pip config set global.index-url https://mirror.sjtu.edu.cn/pypi/web/simple

或者创建或编辑 ~/.config/pip/pip.conf 文件,加入或修改 index-url 相关段落为:

[global] index-url = https://mirror.sjtu.edu.cn/pypi/web/simple format = columns

不完全统计,pip的国内镜像源如下:

上海交通大学 https://mirror.sjtu.edu.cn/pypi/web/simple 阿里云   http://mirrors.aliyun.com/pypi/simple/ 中国科技大学   https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban)   http://pypi.douban.com/simple/ 清华大学   https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科学技术大学   http://pypi.mirrors.ustc.edu.cn/simple/


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3