Configure pip domestic mirrors to speed up python third-party library installation~
The network these days is a bit unfriendly for developers, downloading anything is slow, pip install is slow, git clone is slow too, so frustrating... Fortunately there are various alternative domestic mirror sources that can speed things up Temporary configuration When using pip, add the parameter -i https://pypi.tuna.tsinghua.edu.cn/simple For example: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple d
目录7 个章节
The network these days is a bit unfriendly for developers, downloading anything is slow, pip install is slow, git clone is slow too, so frustrating...
Fortunately there are various alternative domestic mirror sources that can speed things up
Temporary Configuration
When using pip, add the parameter -i https://pypi.tuna.tsinghua.edu.cn/simple
For example: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple django, this will install the django library from Tsinghua's mirror, and it will be much faster.
Persistent Configuration
By modifying the configuration file, you can make pip use the specified mirror source every time you install.
Linux
On Linux, modify ~/.pip/pip.conf (if the path doesn't exist, you need to create the folder and file yourself)
The content is as follows:
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
Windows
Windows configuration is a bit different from Linux. Just create a pip directory in the user directory, then create a new file pip.ini. (For example: C:\Users\Administrator\pip\pip.ini) The content is the same as above.
Common Domestic Mirror Sources
- Tsinghua - https://pypi.tuna.tsinghua.edu.cn/simple
- Alibaba Cloud - http://mirrors.aliyun.com/pypi/simple/
- University of Science and Technology of China - https://pypi.mirrors.ustc.edu.cn/simple/
- Huazhong University of Science and Technology: http://pypi.hustunique.com/
- Shandong University of Technology: http://pypi.sdutlinux.org/
- Douban: http://pypi.douban.com/simple/
Anaconda Configuration
Modify the ~/.condarc file
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# 如果需要使用其他第三方源(参考上方完整列表)
# 例如 conda install -c pytorch-test,则可以添加
#pytorch-test: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
Reference - https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
The following is the old version
Configure USTC source
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yesConfigure Tsinghua University source
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --set show_channel_urls yes
If a mirror source website goes down, when switching sources remember to go to the user directory and delete the original Tsinghua mirrors under the .condarc folder.
About
- WeChat Official Account: 画星星高手
- Coding livestream: https://live.bilibili.com/11883038
- Zhihu: https://www.zhihu.com/people/dealiaxy
- Blog: https://blog.deali.cn
- Jianshu: https://www.jianshu.com/u/965b95853b9f
_EOF_
Configure pip domestic mirrors to speed up python third-party library installation~
- 本文作者:
- 程序设计实验室
- 版权声明:
- 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
相关文章
python实现解析markdown文档中的图片,并且保存到本地~
背景 前阵子简书好像说是凉了,搞得我有点小慌,毕竟我的大部分博客都是放在简书上面的,虽然简书提供了打包导出功能,但是只能导出文字,图片的话还是存在简书服务器上面,再加上我一直想要重新做一个个人博客,于是就有了这篇文章。 思路 首先是要解析markdown文档,然后获取到其中的所有图片,再把图片按md文件分好目录保存。 解析markdown文档 这里我用了misaka模块,据说是python的mar
2021-12-18 · Python · 约 1 分钟
Python实现给图片加水印功能
前言 最近忙得连轴转,很久没更新博客了,代码倒是没啥写,积累了好些东西,接下来一有时间就来更新吧~ 本文记录使用Python实现给图片添加水印的功能实现过程 先看效果 把公众号的封面作为素材 原图是这样的 codelab 加个水印的效果 temp 实现代码 主要实现是参考GitHub上一个项目的:https://github.com/2Dou/watermarker 用到了Pillow库,使用前请
2022-09-29 · Python · 约 1 分钟
Python数据展示 - 生成表格图片
前言 前一篇文章介绍了推送信息到企业微信群里,其中一个项目推送的信息是使用Python自动生成的表格,本文来讲讲如何用Python生成表格图片。 选一个合适库 Python最大的优点就是第三方库丰富,基本你要什么功能,都能找到别人实现好的库,几行代码一调用就完事了。 Pytable 项目地址:https://github.com/HiroshiARAKI/pytable 最先找到的是日本人开发的p
2022-04-09 · Python · 约 1 分钟
Python踩坑:类与类对象类型参数传递与使用
前言 对初学者来说,Python确实简单好用,毕竟动态类型语言,不用定义就可以拿来用,类型之间随意转换简直不要太方便,因此Python用来写写小脚本,爬虫程序什么的,没什么问题。 不过,一旦用来开发稍微大型一点的项目,例如搭建一个Web应用,就会遇到一些问题,一般缺乏经验的人都会陷入某些坑中。= =... 坑 先说坑,函数参数类型是一坑,类与类的对象这又是一坑。 虽然之前用其他静态类型语言(例如C
2022-05-27 · Python · 约 1 分钟
讨论
共 0 条加载评论中…