我尝试卸载Anaconda,然后重新安装。
但是当我验证安装时,python环境仍在使用默认的python 2.7.10。从终端:
username ~ $ conda list
WARNING: The conda.compat module is deprecated and will be removed in a future release.
# packages in environment at /Users/username/anaconda3:
#
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py37_0
alabaster 0.7.12 py37_0
anaconda 2019.03 py37_0
anaconda-client 1.7.2 py37_0
anaconda-navigator 1.9.7 py37_0
anaconda-project 0.8.2 py37_0
username ~ $ python
Python 2.7.10 (default, Aug 17 2018, 19:45:58)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
我的.bash_profile如下:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/username/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/username/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/username/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/username/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
我猜这也导致当我使用终端启动Jupyter Notebook时,它也使用python 3,Jupyter可以执行pip list
,但是当执行conda list
时,它会提示: / p>
ValueError: The python kernel does not appear to be a conda environment. Please use ``%pip install`` instead.
Anaconda导航器启动的jupyter环境可以执行pip list
和conda list
。