在 bash 终端上运行conda update conda
,下面是回溯。
知道我的安装出了什么问题吗?
yusuf@yusuf-pc2:~$ conda update conda
Traceback (most recent call last):
File "/usr/local/bin/conda", line 11, in <module>
load_entry_point('conda==4.2.7', 'console_scripts', 'conda')()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 567, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2612, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2272, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2278, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/dist-packages/conda/cli/__init__.py", line 8, in <module>
from .main import main # NOQA
File "/usr/local/lib/python2.7/dist-packages/conda/cli/main.py", line 46, in <module>
from ..base.context import context
File "/usr/local/lib/python2.7/dist-packages/conda/base/context.py", line 18, in <module>
from ..common.configuration import (Configuration, MapParameter, PrimitiveParameter,
File "/usr/local/lib/python2.7/dist-packages/conda/common/configuration.py", line 40, in <module>
from ruamel.yaml.comments import CommentedSeq, CommentedMap # pragma: no cover
ImportError: No module named ruamel.yaml.comments
yusuf@yusuf-pc2:~$
ruamel 包的位置:
/home/yusuf/anaconda2/lib/python2.7/site-packages/ruamel_yaml/comments.py
/home/yusuf/anaconda2/lib/python2.7/site-packages/ruamel_yaml/comments.pyc
路径需要修正。有什么办法可以修复吗?
答案1
看来您的系统上安装了两个 anaconda 实例。一个安装到 /usr/local/,另一个安装到您的主目录。
从 bash shell 中,使用此命令(临时)修改您的路径:
export PATH="/home/yusuf/anaconda2/bin:$PATH"
然后再次尝试更新:
conda update conda
这应该可以解决问题。然后您可以将该export PATH...
行添加到文件底部~/.bashrc
,修复将持续有效。
假设我正确猜出了这个问题的原因,您将需要删除重复的安装 - 只要没有其他系统用户正在使用它。
要解决重复安装问题,在正常情况下,您只需删除不需要的 anaconda 安装即可 - 但是,由于您已将其安装到该目录中,因此/usr/local/
您需要非常小心 - 其他应用程序可能会安装到该目录中。只需将每个条目重命名/usr/local/bin/conda
为并重命名为 就足以阻止使用该安装,但这远非完美的解决方案。/usr/local/bin/old.conda
/usr/local/bin/python*