在本教程(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.
了解更多信息...
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
答案 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