无法在Mac 10.11上运行Anaconda

时间:2017-07-01 23:30:49

标签: python pip anaconda

在本教程(3.16)中,从主anaconda网站下载然后运行图形安装程序,然后在mac终端上输入:

$ python
Python 3.5.2 |Anaconda 4.1.1 (x86_64)|...

然而,当我做同样的事情时,它给了我以下内容:

JOHNMAC:~ Main$ python
Python 2.7.13 (default, Apr  4 2017, 08:46:44) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more 
information.
  1. 为什么不用python版本3?
  2. 它真的在运行Anaconda吗?它没有像我教程的计算机那样显示Anaconda版本......
  3. 了解更多信息...

    JOHNMAC:~ Main$ python3
    Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04) 
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    

    检查$ PATH:

    JOHNMAC:~ Main$ echo $PATH
    /usr/local/bin:/usr/local/sbin:/Users/Main/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    

    Conda信息:

    JOHNMAC:~ Main$ conda info
    Current conda install:
    
               platform : osx-64
          conda version : 4.3.22
       conda is private : False
      conda-env version : 4.3.22
    conda-build version : not installed
         python version : 3.6.1.final.0
       requests version : 2.14.2
       root environment : /Users/Main/anaconda  (writable)
    default environment : /Users/Main/anaconda
       envs directories : /Users/Main/anaconda/envs
                          /Users/Main/.conda/envs
          package cache : /Users/Main/anaconda/pkgs
                          /Users/Main/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/osx-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/osx-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/osx-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /Users/Main/.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.22 requests/2.14.2 CPython/3.6.1 Darwin/15.6.0 OSX/10.11.6    
                UID:GID : 501:20
    

1 个答案:

答案 0 :(得分:1)

尝试输入which python以查看python二进制文件的来源。

因为Unix以PATH顺序查找二进制文件,它将首先检查/usr/local/bin中的python,并使用预安装的python而不是Anaconda在/Users/Main/anaconda/bin/python安装的python。

要解决此问题,您可以通过运行:

来更改PATH顺序
export PATH=/Users/Main/anaconda/bin:/usr/local/bin:/usr/local/sbin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin