当前位置:   article > 正文

MacOS安装brew_run these two commands in your terminal to add hom

run these two commands in your terminal to add homebrew to your path:

1. 检查系统自带Python版本

python --version

2. 安装Homebrew

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

安装完提示如下

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

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

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

安装完成后,检查brew版本

brew -v

结果

Homebrew 4.1.17

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

  1. ==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
  2. Read the analytics documentation (and how to opt-out) here:
  3. 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;激活环境)

  1. python3 -m venv myenv
  2. source myenv/bin/activate

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

(myenv) sysname ~ %
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/在线问答5/article/detail/787738
推荐阅读
相关标签
  

闽ICP备14008679号