Mac 安装python3

作者: 冲云简 | 来源:发表于2018-11-07 18:24 被阅读0次

    通过homebrew安装python,运行
    brew search python3
    搜索到python3安装包后,运行
    brew install python3
    等安装好了,运行
    python3
    查看python版本。

    更改mac 终端默认运行,来源其他博客
    1,首先打开终端

    open ~/.bash_profile
    

    打开配置文件

    1. 写入python的外部环境变量(本人的版本是3.7)

    export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/3.7/bin

    3.重命名python

    alias python="/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.7"

    (这步很重要,直接关系到默认启动的python版本是否修改)

    4.关闭文件后,在终端调用 source ~/.bash_profile

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

    友情建议:如果你想要使用VSCode编写python文件。请下载vscode,然后在商店中下载python包。

    相关文章

      网友评论

        本文标题:Mac 安装python3

        本文链接:https://www.haomeiwen.com/subject/mdtbxqtx.html