在 Windows 10(64 位)上安装 Anaconda 后,如果我打开 Anaconda Prompt,我可以毫无问题地执行“conda info”。我将 C:/Users/DJ/Anaconda3 和 C:/Users/DJ/Anaconda3/Scripts 添加到系统路径。在 Windows 命令提示符中,输入“python”会进入 python 解释器。但是,如果我输入“conda info”,我会得到以下输出:
C:\Users\DJ>conda 信息
>>>>>>>>>>>>>>>>>>>>>> 错误报告 <<<<<<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\Users\DJ\Anaconda3\lib\site-packages\conda\exceptions.py", line 1043, in __call__
return func(*args, **kwargs)
File "C:\Users\DJ\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
exit_code = do_call(args, p)
File "C:\Users\DJ\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\DJ\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\DJ\Anaconda3\lib\site-packages\conda\cli\main_info.py", line 19, in <module>
from ..core.index import _supplement_index_with_system
File "C:\Users\DJ\Anaconda3\lib\site-packages\conda\core\index.py", line 9, in <module>
from .package_cache_data import PackageCacheData
File "C:\Users\DJ\Anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
from conda_package_handling.api import InvalidArchiveError
File "C:\Users\DJ\Anaconda3\lib\site-packages\conda_package_handling\api.py", line 3, in <module>
from libarchive.exception import ArchiveError as _LibarchiveArchiveError
File "C:\Users\DJ\Anaconda3\lib\site-packages\libarchive\__init__.py", line 1, in <module>
from .entry import ArchiveEntry
File "C:\Users\DJ\Anaconda3\lib\site-packages\libarchive\entry.py", line 6, in <module>
from . import ffi
File "C:\Users\DJ\Anaconda3\lib\site-packages\libarchive\ffi.py", line 27, in <module>
libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
File "C:\Users\DJ\Anaconda3\lib\ctypes\__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "C:\Users\DJ\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None
$ C:\Users\DJ\Anaconda3\Scripts\conda-script.py info
什么原因导致此错误?
答案1
为了解决上述问题,我们有两种方法:
1 - 您可以使用“Anaconda 提示符“ 分别地
按 ”视窗“按钮和搜索”Anaconda 提示符“并使用它。”conda 信息“命令将会成功执行。
2 - 您还可以使用“命令提示符“
首先,选择您的安装路径“蟒蛇“(其中存在“Anaconda”文件夹)。
完整路径:目录:\ProgramData\Anaconda3
例如:使用此路径 => C:\ProgramData
现在,设置路径后,您必须使用命令“激活根“。
例如:路径 =>C:\ProgramData> 激活根目录
现在您将获得“(根据)“作为路径中的前缀。
例如:路径 =>(基础)C:\ProgramData>
现在,我们可以执行“conda 信息“ 命令。
例如:路径 =>(基础)C:\ProgramData>conda info