我从这里开始运行这个例子; http://conda.pydata.org/docs/index.html
我在Mac上,10.8.5。我可能肯定已经压扁了一些东西,因为我最初遇到了我的Anaconda的麻烦,但我认为它现在正在运作。为了进行健全性检查,我运行了上面帮助中显示的示例。它只是创建一个新的conda环境,其中包含较旧的numpy版本,然后显示source activate [env]如何获得首选项目。
就我而言,一切似乎运行良好,但numpy的版本保持不变。有什么想法吗?非常感谢你!
$ ~/anaconda/bin/python2.7 Python 2.7.6 |Anaconda 1.9.2 (x86_64)| (default, Jan 10 2014, 11:23:15) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import numpy nu>>> numpy.__version__ '1.8.1' >>> quit() $ conda create -p ~/anaconda/envs/trynum16 numpy=1.6 anaconda $ source activate ~/anaconda/envs/trynum16 discarding ~/anaconda/bin from PATH prepending ~/anaconda/envs/trynum16/bin to PATH (~/anaconda/envs/trynum16):~ $ echo $PATH ~/anaconda/envs/trynum16/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/bin (~/anaconda/envs/trynum16):~ $ python Python 2.7.5 |Anaconda 1.8.0 (x86_64)| (default, Oct 24 2013, 07:02:20) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> numpy.__version__ '1.8.1' >>> quit() (~/anaconda/envs/trynum16):~ $ echo $PATH ~/anaconda/envs/trynum16/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/bin (~/anaconda/envs/trynum16):~ $ source deactivate discarding ~/anaconda/envs/trynum16/bin from PATH $ echo $PATH ~/anaconda/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/bin
答案 0 :(得分:3)
好的,这是用户错误。我的顶级蟒蛇,非Anaconda,有一个numpy,它首先在路径中被拾取!为了确定冲突并修复它,我做了以下事情。
# Start from Non-Anaconda or Root Python environment $ source deactivate $ conda info -e # conda environments: trynum16 ~/anaconda/envs/trynum16 root * ~/anaconda $ which python /usr/local/bin/python $ echo $PATH /usr/local/bin:~/anaconda/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/bin # Amongst many other items, see the 'offending' numpy here $ pip freeze numpy==1.8.1 # Without Sudo, got error, $ pip uninstall numpy OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/bson/__init__.py' # So did Sudo, probably my mistake on the install? $ sudo pip uninstall numpy $ source activate ~/anaconda/envs/trynum16 $ conda info -e # conda environments: trynum16 * ~/anaconda/envs/trynum16 root ~/anaconda $ python Python 2.7.6 |Continuum Analytics, Inc.| (default, Jan 10 2014, 11:23:15) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin >>> import numpy >>> numpy.__version__ '1.6.2'
执行此操作后,两个具有不同版本的独立conda环境可以正常工作。以下是第二步的完成方式。
预检查:
1.看看PYPI上存在哪些Numpy版本:
https://pypi.python.org/pypi/numpy。
该页面仅显示最新内容,因此请查看历史项目;
下载网址:http://sourceforge.net/projects/numpy/files/NumPy/
2.查看Binstar上Numpy的版本; https://binstar.org/search?q=numpy
# 3.Which NumPy versions have official, public Conda packages? $ conda search numpy Fetching package metadata: ... numpy 1.5.1 py27_0 defaults #...etc # This old version Conflicted with Anaconda, so removed that part. $ conda create -p ~/anaconda/envs/trynum15 numpy=1.5.1 $ source activate /Users/amoroney/anaconda/envs/trynum15 $ conda info -e # conda environments: trynum15 * ~/anaconda/envs/trynum15 trynum16 ~/anaconda/envs/trynum16 root ~/anaconda $ python >>> import numpy >>> numpy.__version__ '1.5.1'