我以前创建过 conda 环境,没有任何问题。所以这次我还是决定创建一个。
conda create -n astropython anaconda
接下来,文档建议通过运行以下命令卸载所有以前的 astropy 副本:
conda uninstall astropy
我这样做了,现在我的 conda 坏了。如果我使用 conda 运行任何命令,我都会收到以下错误回溯。
Traceback (most recent call last):
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 19, in get_yaml
import ruamel_yaml as yaml
ModuleNotFoundError: No module named 'ruamel_yaml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 22, in get_yaml
import ruamel.yaml as yaml
ModuleNotFoundError: No module named 'ruamel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1062, in __call__
return func(*args, **kwargs)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 74, in _main
from ..base.context import context
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 28, in <module>
from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 40, in <module>
from .serialize import yaml_load
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 30, in <module>
yaml = get_yaml()
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/_vendor/auxlib/decorators.py", line 59, in _memoized_func
result = func(*args, **kwargs)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 24, in get_yaml
raise ImportError("No yaml library available.\n"
ImportError: No yaml library available.
To proceed, conda install ruamel_yaml
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 19, in get_yaml
import ruamel_yaml as yaml
ModuleNotFoundError: No module named 'ruamel_yaml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 22, in get_yaml
import ruamel.yaml as yaml
ModuleNotFoundError: No module named 'ruamel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vsanc/anaconda3/bin/conda", line 13, in <module>
sys.exit(main())
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 150, in main
return conda_exception_handler(_main, *args, **kwargs)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1354, in conda_exception_handler
return_value = exception_handler(func, *args, **kwargs)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1065, in __call__
return self.handle_exception(exc_val, exc_tb)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1109, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1120, in handle_unexpected_exception
self.print_unexpected_error_report(error_report)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1175, in print_unexpected_error_report
from .base.context import context
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 28, in <module>
from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 40, in <module>
from .serialize import yaml_load
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 30, in <module>
yaml = get_yaml()
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/_vendor/auxlib/decorators.py", line 59, in _memoized_func
result = func(*args, **kwargs)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 24, in get_yaml
raise ImportError("No yaml library available.\n"
ImportError: No yaml library available.
To proceed, conda install ruamel_yaml
再次运行conda install ruamel_yaml
,会出现相同的回溯。我的 $PATH 是正确的,解决方法是没有名为 ruamel 的模块没有解决问题。
因此,我查看了文件,发现 site-packages 目录中没有 ruamel_yaml 文件夹。我将 ruamel_yaml 文件夹从$HOME/anaconda3/pkgs/ruamel_yaml0.15.71/
复制到$HOME/anaconda3/lib/python3.6/site-packages/
。现在,当我运行任何 conda 命令时,都会出现以下错误:
Traceback (most recent call last):
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1062, in __call__
return func(*args, **kwargs)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 84, in _main
exit_code = do_call(args, p)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 80, in do_call
module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
File "/Users/vsanc/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main_update.py", line 8, in <module>
from .install import install
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 19, in <module>
from ..core.index import calculate_channel_urls, get_index
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 9, in <module>
from .package_cache_data import PackageCacheData
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/package_cache_data.py", line 15, in <module>
from conda_package_handling.api import InvalidArchiveError
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda_package_handling/api.py", line 3, in <module>
from libarchive.exception import ArchiveError as _LibarchiveArchiveError
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/__init__.py", line 1, in <module>
from .entry import ArchiveEntry
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/entry.py", line 4, in <module>
from ctypes import c_char_p, create_string_buffer
File "/Users/vsanc/anaconda3/lib/python3.6/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libffi.6.dylib
Referenced from: /Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so
Reason: image not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vsanc/anaconda3/bin/conda", line 13, in <module>
sys.exit(main())
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 150, in main
return conda_exception_handler(_main, *args, **kwargs)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1354, in conda_exception_handler
return_value = exception_handler(func, *args, **kwargs)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1065, in __call__
return self.handle_exception(exc_val, exc_tb)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1109, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1120, in handle_unexpected_exception
self.print_unexpected_error_report(error_report)
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1190, in print_unexpected_error_report
from .cli.main_info import get_env_vars_str, get_main_info_str
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main_info.py", line 19, in <module>
from ..core.index import _supplement_index_with_system
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 9, in <module>
from .package_cache_data import PackageCacheData
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/package_cache_data.py", line 15, in <module>
from conda_package_handling.api import InvalidArchiveError
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda_package_handling/api.py", line 3, in <module>
from libarchive.exception import ArchiveError as _LibarchiveArchiveError
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/__init__.py", line 1, in <module>
from .entry import ArchiveEntry
File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/entry.py", line 4, in <module>
from ctypes import c_char_p, create_string_buffer
File "/Users/vsanc/anaconda3/lib/python3.6/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libffi.6.dylib
Referenced from: /Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so
Reason: image not found