No module named ‘pip._internal‘
程序员文章站
2022-07-08 15:58:40
问题描述在项目编译过程中出现了错误导致编译中断, 错误提示具体如下:Traceback (most recent call last): File "setup.py", line 219, in if not is_installed('cython_bbox'): File "setup.py", line 177, in is_installed from pip._internal.utils.misc import get_installe...
问题描述
在项目编译过程中出现了错误导致编译中断, 错误提示具体如下:
Traceback (most recent call last):
File "setup.py", line 219, in <module>
if not is_installed('cython_bbox'):
File "setup.py", line 177, in is_installed
from pip._internal.utils.misc import get_installed_distributions
ModuleNotFoundError: No module named 'pip._internal'
然后在自己的python环境中尝试导入报错如下:
[Muyi@ai-research AlphaPose-master]$ python3
Python 3.6.2 (default, Nov 19 2019, 14:03:45)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pip._internal.utils.misc import get_installed_distributions
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/Muyi/Python/Package/python36/lib/python3.6/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/Muyi/Python/Package/python36/lib/python3.6/site-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/home/Muyi/Python/Package/python36/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
@_call_aside
File "/home/Muyi/Python/Package/python36/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/home/Muyi/Python/Package/python36/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/home/Muyi/Python/Package/python36/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/home/Muyi/Python/Package/python36/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/Muyi/Python/Package/python36/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/home/Muyi/Python/Package/python36/lib/python3.6/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'
解决方案
这意味着依赖关系混乱了,尝试了 pip3 install --upgrade setuptools 等一些方法,未能处理这个问题。
最后我通过重新安装 pip 解决了这个问题。
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
本文地址:https://blog.csdn.net/Noonebirdyou/article/details/110877378
上一篇: python module
下一篇: 真是诚信敬业
推荐阅读
-
解决python "No module named pip"的问题
-
详解如何更好的使用module vuex
-
解决Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com
-
IIS URL Rewrite Module防盗链规则配置方法
-
Win7系统开机提示igfxhk module已停止工作的两种解决方法图文教程
-
go module使用本地包的方法示例
-
Android studio将Module打包成Jar的方法
-
ES6新特性之模块Module用法详解
-
from dns.resolver import Resolver ImportError: No module named dns.resolver
-
Python 使用redis报:No module named redis问题