Mac os python升级

您所在的位置:网站首页 macpython升级到36 Mac os python升级

Mac os python升级

2023-11-25 14:29| 来源: 网络整理| 查看: 265

MAC 系统自带python2,升级到python3的操作:

brew install python

brew upgrade python

安装结束后会有下面提示:

If you need to have [email protected] first in your PATH, run:

  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:

  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"

For pkg-config to find [email protected] you may need to set:

  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

将这三个环境变量和 alias python='python3'

配置到 ~/.bash_profile

source ~/.bash_profile

同时配置~/.zshrc

if [ -f ~/.bash_profile ]; then

   source ~/.bash_profile

fi

export PATH=/usr/local/opt/[email protected]/bin:$PATH

python --version 验证为结果



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3