conda 更新后 Anaconda 损坏 -all

conda 更新后 Anaconda 损坏 -all

我最近运行conda update --all更新 Python 库,但我的 conda 坏了。每次执行 conda 命令时都会出现以下错误。以下是错误。

C:\Users\anves>conda update
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 1062, in __call__
    return func(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 80, in do_call
    module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
  File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main_update.py", line 8, in <module>
    from .install import install
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\install.py", line 19, in <module>
    from ..core.index import calculate_channel_urls, get_index
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\index.py", line 9, in <module>
    from .package_cache_data import PackageCacheData
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
    from conda_package_handling.api import InvalidArchiveError
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_package_handling\api.py", line 3, in <module>
    from libarchive.exception import ArchiveError as _LibarchiveArchiveError
  File "C:\ProgramData\Anaconda3\lib\site-packages\libarchive\__init__.py", line 1, in <module>
    from .entry import ArchiveEntry
  File "C:\ProgramData\Anaconda3\lib\site-packages\libarchive\entry.py", line 6, in <module>
    from . import ffi
  File "C:\ProgramData\Anaconda3\lib\site-packages\libarchive\ffi.py", line 48, in <module>
    libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
  File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 434, in LoadLibrary
    return self._dlltype(name)
  File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\Scripts\conda-script.py", line 12, in <module>
    sys.exit(main())
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 150, in main
    return conda_exception_handler(_main, *args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 1354, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 1065, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 1109, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 1120, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "C:\ProgramData\Anaconda3\lib\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 "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main_info.py", line 19, in <module>
    from ..core.index import _supplement_index_with_system
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\index.py", line 9, in <module>
    from .package_cache_data import PackageCacheData
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
    from conda_package_handling.api import InvalidArchiveError
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_package_handling\api.py", line 7, in <module>
    from .tarball import CondaTarBZ2 as _CondaTarBZ2
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_package_handling\tarball.py", line 7, in <module>
    import libarchive
  File "C:\ProgramData\Anaconda3\lib\site-packages\libarchive\__init__.py", line 1, in <module>
    from .entry import ArchiveEntry
  File "C:\ProgramData\Anaconda3\lib\site-packages\libarchive\entry.py", line 6, in <module>
    from . import ffi
  File "C:\ProgramData\Anaconda3\lib\site-packages\libarchive\ffi.py", line 48, in <module>
    libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
  File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 434, in LoadLibrary
    return self._dlltype(name)
  File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None

答案1

没什么解决办法……但我只需重新安装 conda 即可,无需再费心。这样就解决了问题。

请务必备份您的环境和其他文件。

相关内容