Anaconda Python:conda更新导致AssertionError(),并且没有名为“ conda_package_handling”的模块

时间:2019-10-03 15:08:11

标签: python anaconda conda

我尝试使用以下命令将conda更新到最新版本:

(base) PS C:\> conda update -n base -c defaults conda
Preparing transaction: done
Verifying transaction: done
Executing transaction: - DEBUG menuinst_win32:__init__(199): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'C:\Users\username\AppData\Local\Continuum\anaconda3', env_name: 'None', mode: 'user', used_mode: 'user'
DEBUG menuinst_win32:create(323): Shortcut cmd is C:\Users\username\AppData\Local\Continuum\anaconda3\python.exe, args are ['C:\\Users\\username\\AppData\\Local\\Continuum\\anaconda3\\cwp.py', 'C:\\Users\\username\\AppData\\Local\\Continuum\\anaconda3', 'C:\\Users\\username\\AppData\\Local\\Continuum\\anaconda3\\python.exe', 'C:\\Users\\username\\AppData\\Local\\Continuum\\anaconda3\\Scripts\\jupyter-notebook-script.py', '"%USERPROFILE%/"']
done
Rolling back transaction: done

AssertionError()
()
AssertionError()
AssertionError()

在这一点之后,基本的蟒蛇python似乎已损坏,并且与常规conda命令有关的一切似乎都返回了相同的No模块,名为“ conda_package_handling”错误。我该如何解决,请告知。

例如:

(base) PS C:\> conda list
Error processing line 1 of C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib-3.1.0-py3.7-nspkg.pth:

  Traceback (most recent call last):
    File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 580, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1062, in __call__
    return func(*args, **kwargs)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "C:\Users\username\AppData\Local\Continuum\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:\Users\username\AppData\Local\Continuum\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:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main_list.py", line 14, in <module>
    from ..core.prefix_data import PrefixData
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\core\prefix_data.py", line 24, in <module>
    from ..gateways.disk.create import write_as_json_to_file
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\gateways\disk\create.py", line 17, in <module>
    import conda_package_handling.api
ModuleNotFoundError: No module named 'conda_package_handling'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\Scripts\conda-script.py", line 12, in <module>
    sys.exit(main())
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main.py", line 150, in main
    return conda_exception_handler(_main, *args, **kwargs)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1354, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1065, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1109, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1120, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "C:\Users\username\AppData\Local\Continuum\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:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main_info.py", line 19, in <module>
    from ..core.index import _supplement_index_with_system
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\core\index.py", line 9, in <module>
    from .package_cache_data import PackageCacheData
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
    from conda_package_handling.api import InvalidArchiveError
ModuleNotFoundError: No module named 'conda_package_handling'

1 个答案:

答案 0 :(得分:1)

这似乎是an ongoing issue。不幸的是,似乎大多数用户最终不得不重新安装才能解决该问题。