MacOS安装brew

1. 检查系统自带Python版本

python --version

2. 安装Homebrew

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

安装完提示如下

Warning: /opt/homebrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
==> Installation successful!

复制粘贴“Next Step”提示的命令行,添加路径

==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/leahchen/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"

安装完成后,检查brew版本

brew -v

结果

Homebrew 4.1.17

安装brew过程中,命令行提示

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

如果想关闭,发送如下命令

export HOMEBREW_NO_ANALYTICS=1

3. 使用Homebrew安装Python

brew install python

安装完成,检查python 版本

python3 --version

结果

Python 3.9.6

4. 配置虚拟环境(配置虚拟环境名:myenv;激活环境)

python3 -m venv myenv
source myenv/bin/activate

结果:回车后在系统名称前有虚拟环境名称(myenv)

(myenv) sysname ~ %
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值