我从这里运行这个例子;http://conda.pydata.org/docs/index.html
我在苹果电脑上,10.8.5。我可能肯定压扁了一些东西,因为我最初对我的蟒蛇有问题,但我认为它现在起作用了。为了进行理智检查,我运行了上面帮助中显示的示例。它只是创建了一个新的conda环境,使用了一个较旧的Numpy版本,然后显示了源激活[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
OK,这是用户错误。我的顶级蟒蛇,非蟒蛇,有一个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'