【问题标题】:system python versus user python in 2.72.7 中的系统 python 与用户 python
【发布时间】:2017-11-20 00:35:36
【问题描述】:

我已经使用 macports 安装了 Python 2.7,并且由于我的 $PATH 变量,这是我在键入 $ python 时得到的变量。但是,virtualenv 默认使用 Python 2.6,除非我记得使用 -p 标志强制它执行其他操作。

在相关说明中,全局运行的 yolk -l 显示以下内容:

Python - 2.6.1 - 积极开发 (/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload) 所以我的问题是,我应该做些什么来确保系统始终使用 MacPorts 的 Python 2.7,还是不必担心 Apple 的 Python 2.6.1 显然也在其中?

【问题讨论】:

    标签: python macos macports


    【解决方案1】:

    用途:

    $ sudo port select --set python2 python27
    

    【讨论】:

      【解决方案2】:

      为了使用MacPorts 版本作为您的主要Python 尝试:

      $ sudo port select --set python python27
      

      $ sudo port select --set python2 python27
      

      要使其成为默认的 Python 或 Python 2(即,由 'python' 或 'python2' 命令),运行一个或两个。

      * 重新启动 Terminal.app,或您正在使用的任何控制台,然后尝试:

      $ which python
      $ python -V
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-07-07
        • 2019-09-26
        • 2014-03-15
        • 2018-01-19
        • 2012-09-03
        • 2016-11-15
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多