Mac安装Homebrew pip

系统更新后brew和pip命令均显示command not found

无奈之下只好重新安装

Homebrew

方法一:

执行命令:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

可能会出现如下报错或者速度极慢:

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

这是由于 http://raw.githubusercontent.com 访问不稳定引起的。

方法二(更高效快速稳定):

/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"

该脚本用了中科大镜像加速访问,仅修改仓库地址部分,不会产生安全隐患。 关于中科大所提供的 Homebrew 镜像服务 https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git

配置Homebrew

Homebrew在安装软件时非常慢。为了提升安装速度,需要更改 Homebrew 的安装源,将其替换成国内镜像。

这里用的是由中科大负责托管维护的 Homebrew 镜像。其中,前两个为必须配置的项目,后两个可按需配置。

(1)替换 brew.git:

git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git

(2)替换homebrew-core.git :

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

(3)替换homebrew-cask.git :

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

(4)替换homebrew-bottles:

 首先要先区分你的mac用哪种终端工具,如果是 bash,则执行:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

若是 zsh,则执行:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

pip

使用pip3时一直收到提示:


WARNING: You are using pip version 20.1.1; however, version 21.3.1 is available.

You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -m pip install --upgrade pip' command.


说明我的pip版本版本太低,需要升级。

虽然这里提示是用'pip install --upgrade pip'升级,但是不能这样输入,要输入:

pip3 install --upgrade pip

很顺利就升级到最新版本啦 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值