脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - mac下pip、conda、homebrew修改为清华镜像源的方法

mac下pip、conda、homebrew修改为清华镜像源的方法

2021-12-20 00:13皮皮管理 Python

本文主要介绍了mac下pip、conda、homebrew修改为清华镜像源的方法,文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

一、pip 修改为清华镜像源

① 打开终端,输入 cd ~/.pip/ ;如果没有 .pip 文件夹,就新建: mkdir .pip
cd .pip
vim pip.conf
④ 粘贴如下内容(清华镜像源),粘贴后,按 esc 退出编辑模式,按 :wq! 进行保存并退出。你可以再打开终端依次输入②和③检查有没有粘贴成功。

?
1
2
3
4
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn

【备注】 .pip文件路径为 /users/你的账户名/ .pip。按shift+command+ . 就能看到这些隐藏文件了,再按一次就能恢复隐藏。

二、conda 修改为清华镜像源

?
1
2
3
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

三、homebrew 修改为清华镜像源

① 打开终端,输入下面这一行,会自动生成文件名为 brew_install的文件(文件路径为 /users/你的账户名/brew_install )

?
1
2
curl -fssl https://raw.githubusercontent.com/homebrew/install/master/install >> brew_install

② 右键点击brew_install,打开方式选择 “文本编辑.app”。打开后如图所示,加 # 号注释掉原来的源,再把下面这一行复制粘贴进去即可,保存后关闭文件。

?
1
brew_repo = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze

mac下pip、conda、homebrew修改为清华镜像源的方法

③ 终端输入 /usr/bin/ruby brew_install 耐心等待(也要等很久)
④ 终端输入下面的内容即可完成。(提示:会自动安装 git 工具,等待即可)

?
1
2
3
4
5
6
7
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
 
cd "$(brew --repo)/library/taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
 
brew update

到此这篇关于mac下pip、conda、homebrew修改为清华镜像源的方法的文章就介绍到这了,更多相关pip、conda、homebrew修改为清华镜像源内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://blog.csdn.net/fenghaodaxia/article/details/104520248

延伸 · 阅读

精彩推荐