1. 执行 brew install pyenv
2. 安装python,pyenv install 2.7.18
3. 设置全局默认 pyenv global 2.7.18
可写入 .zshrc 或 .bash_profile 中
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
下面需要在 npm install 的时候,使用python2进行编译:
npm config set python /Users/jerry/.pyenv/versions/2.7.18/bin/python
转【https://imho.plus/python2-in-mac-monterey/】
标签:MacOs,install,python,18,pyenv,版本,2.7 From: https://www.cnblogs.com/juexin/p/17318853.html