No module named ‘pip._internal‘
程序员文章站
2022-04-02 11:12:57
问题描述在项目编译过程中出现了错误导致编译中断, 错误提示具体如下: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学习之随机函数random
下一篇: 沙特发布国家数据和人工智能战略
推荐阅读
-
file-loader打包图片文件时路径错误输出为[object-module]的解决方法
-
前端MVC Vue2学习总结(七)——ES6与Module模块化、Vue-cli脚手架搭建、开发、发布项目与综合示例
-
PHP加密3DES报错 Call to undefined function: mcrypt_module_open() 的解决方法,mcryptmoduleopen_PHP教程
-
duxcms SQL Injection In /admin/module/loginMod.class.php
-
学习Python遇到问题: import urllib.request ImportError: No module named request
-
androidstudio 添加module
-
ES6入门教程之Class和Module详解
-
Apache2.4 authz_core_module模块使用,authzcoreerror_PHP教程
-
AndroidStudio中导入module
-
下载python中Crypto库报错:ModuleNotFoundError: No module named ‘Crypto’的解决