遇到一个问题,我不确定如何解决: 安装了VS Code,并使用Homebrew来安装Python 3.7,然后又安装了Anaconda-可以选择将其安装到我的用户主目录,然后选择该选项。
但是当我启动Terminal或VS Code时,我遇到了此错误-我可能错过了什么?
Last login: Sat Dec 22 22:04:18 on ttys000
Traceback (most recent call last):
File "/Users/<myusername>/anaconda2/bin/conda", line 7, in <module>
from conda.cli import main
ImportError: No module named conda.cli
(运行Sierra的Mac)
我尝试了以下操作:
export PYTHONPATH="$HOME/.miniconda2/lib/python2.7:$HOME/.miniconda2/lib/python2.7/site-packages:$PYTHONPATH"
,并且路径确实包含Anaconda的路径。 Python表示还存在Anaconda:
Python 3.7.1 (default, Dec 14 2018, 13:28:58)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
我确定我错过了某个地方的细节,但不确定是什么。
答案 0 :(得分:0)
就像一个蛮力的解决方案,但是运行anaconda-clean然后卸载anaconda2和anaconda3,最后重新安装anaconda3似乎解决了这个问题,因为我实际上在Python2.7上不需要anaconda。我想如果我同时需要它们,那么正确的解决方案是设置其他环境来解决此问题。