我下载了Anaconda3并创建了新的环境env_python36_for_dl
,当我打开终端时,错误显示为
Traceback (most recent call last):
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\Scripts\pip-script.py", line 3, in <module>
import pip
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\lib\site-packages\pip\__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\lib\site-packages\pip\utils\__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3018, in <module>
@_call_aside
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2578, in activate
declare_namespace(pkg)
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "C:\Users\Yurak\AppData\Local\conda\conda\envs\env_python36_for_dl\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2121, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
我已经使用Anaconda3设置了pip
和setuptools
。
如果我在终端中打开Anaconda3 root environment
,pip
正常工作。
我不知道new environment
之间的root environment
个差异。
答案 0 :(得分:2)
我有一个解决方案:
1,首先打开Anaconda Navigator,然后安装'setuptools' 2,打开Anaconda提示并输入'easy_install pip'
pip正常工作