关键词搜索

源码搜索 ×
×

MAC Pro 同时安装 Python2 和 Python3

发布2020-03-03浏览2663次

详情内容

目录

安装 Python2

MAC 系统已经默认带有 Python2.7 了,所以无需安装它。

安装 Python3

brew install python3

    不同版本Python路径

    MAC 系统自带 Python2.7,而我们安装 Python3 的时候,可以通过 brew 命令安装或者官网的 pkg 安装。安装后,它们的文件保存路径如下:

    • 系统默认(2.7):/System/Library/Frameworks/Python.framework/Versionshttps://cdn.jxasp.com:9143/image/2.7
    • brew安装(2.7/3.x):/usr/local/Cellar/python
    • 官网pkg安装(3.x):/Library/Frameworks/Python.framework/Versions/3.x

    配置 Python2 和 Python3

    vi ~/.bash_profile

    # Setting PATH for Python 2.7
    PATH="/System/Library/Frameworks/Python.framework/Versionshttps://cdn.jxasp.com:9143/image/2.7/bin:${PATH}"
    # Setting PATH for Python 3.6.5
    PATH="/usr/local/Cellar/python/3.6.5/bin:${PATH}"
    
    export PATH
    
      2
    • 3
    • 4
    • 5
    • 6

    vi ~/.bashrc

    alias python2='/System/Library/Frameworks/Python.framework/Versionshttps://cdn.jxasp.com:9143/image/2.7/bin/python2.7'
    alias python3='/usr/local/Cellar/python/3.6.5/bin/python3.6'
    
      2

    相关技术文章

    点击QQ咨询
    开通会员
    返回顶部
    ×
    微信扫码支付
    微信扫码支付
    确定支付下载
    请使用微信描二维码支付
    ×

    提示信息

    ×

    选择支付方式

    • 微信支付
    • 支付宝付款
    确定支付下载