Python:Mac Pro让终端默认运行python3.x

    科技2022-07-11  104

    打开终端 vim ~/.bash_profile

    写入python的外部环境变量(本人的版本是3.8) export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/3.8/bin

    在/usr/local/bin/python3.8路径下可查看具体的python安装路径

    重命名python alias python="/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8" (这步很重要,直接关系到默认启动的python版本是否修改)

    source ~/.bash_profile

    在终端调用python,查看是否修改成功

    lilianhong@lilianhongdeMacBook-Pro ~ % python Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information.
    Processed: 0.009, SQL: 8