【发布时间】:2016-02-06 03:06:15
【问题描述】:
我在我的 Mac OS X 上广泛使用 Python,用于数字应用程序和 Web 开发(大致相同)。我检查了我最近在笔记本电脑上安装的 Python 数量,震惊地发现 四个:
Came with Mac OS X:
/usr/bin/python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Installed via Homebrew
/usr/local/bin/python
Python 2.7.10 (default, Jul 13 2015, 12:05:58)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Installed via Anaconda/Miniconda
~/anaconda/bin/python
Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, Oct 19 2015, 18:31:17)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
Came with the downloaded .pkg from python.org
/System/Library/Frameworks/Python.framework/Versions/Current/bin/python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
我决定统一所有这些,并使用conda。我删除了 Homebrew 版本和 Python.org 下载(保留了主系统)。 Conda 非常适合数值计算,因为我可以在根环境中安装 Jupyter/Numpy/Pandas,而不必为每个项目都安装 virtualenvs。
但是现在我的整个 Web 开发工作流程都搞砸了。我的 virtualenvs 都不起作用,因为显然不应该同时使用 conda 和 virtualenv。我尝试从 requirements.txt 文件创建 conda 环境。我与 django 一起使用的一个包是“markdown_deux”,它在 Conda 存储库中不可用。我查看了构建它的方法,但创建一个配方需要付出很多努力(创建 YAML 文件等)
有没有人为此找到一个好的折衷方案?我正在考虑回到自制版本以供一般使用,并编写一个别名以根据需要将路径更改回 conda 版本。虽然这也需要跟踪我现在使用的是哪一个..
【问题讨论】:
-
请问你是怎么知道有四个的?你用来查找那些 python 发行版的命令是什么?
-
你可以在 Mac 或 Linux 中尝试这样的事情:
locate python | grep "bin/python"
标签: python macos numpy homebrew anaconda