【问题标题】:change python executable to the one installed by brew on mac for virtualenv将 python 可执行文件更改为 brew 在 mac 上为 virtualenv 安装的可执行文件
【发布时间】:2013-11-21 09:23:56
【问题描述】:

我的 Mac 在 /usr/bin 中安装了 python 2.7.2。然而对于我们的项目,我需要使用 python 2.7.6。所以我做了一个 brew install python。

现在 python 2.7.6 安装在 /usr/local/bin/python 中。然而,当我创建一个新的 virtualenv 时,它仍然会创建一个安装在 /usr/bin 中的 2.7.2 python 版本。

如何告诉 virtualenv 用 2.7.6 版本创建虚拟环境?

有什么想法吗?

【问题讨论】:

    标签: python macos virtualenv homebrew


    【解决方案1】:

    在创建环境时使用这个标志:

     $ virtualenv --help
    Usage: virtualenv [OPTIONS] DEST_DIR
    
    Options:
      ...
      -p PYTHON_EXE, --python=PYTHON_EXE
                            The Python interpreter to use, e.g.,
                            --python=python2.5 will use the python2.5 interpreter
                            to create the new environment.  The default is the
                            interpreter that virtualenv was installed with
                            (/usr/bin/python)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-05
      • 1970-01-01
      相关资源
      最近更新 更多