装python2主要是为了解决项目使用node-sass安装依赖错误的问题
安装步骤:
- exec the command in terminal
brew install pyenv
arch -x86_64 pyenv install 2.7.18
- write path in .bash_profile or .zshrc
#.bash_profile
export PYENV_ROOT=/Users/lilv/Code/Tools/pyenv
export PATH="$PYENV_ROOT/shims:$PATH"
#.zshrc
if [ -f ~/.bash_profile ]; then
. ~/.bash_profile;
fi
- install 2.7.18 in terminal and use it
pyenv install 2.7.18
pyenv golbal 2.7.18
- check python version
pyenv versions
Tips:
The Python ssl extension was not compiled. Missing the OpenSSL lib?
solution: brew uninstall --ignore-dependencies openssl