gpt4 book ai didi

python - 导入错误 : No module named sysconfig--can't get pip working

转载 作者:太空狗 更新时间:2023-10-29 22:17:38 25 4
gpt4 key购买 nike

我真的很难在 RedHat 6.9 系统上使用 pip。每次我尝试使用 pip 时,我都会得到

ImportError: No module named sysconfig

我尝试使用谷歌搜索解决方案。我没有 apt-get 并且似乎无法通过 yum 获得它,所以清除 setuptools 是不可能的。我已尽力手动删除 setuptools,以便重新安装它们,但 yum 确信机器上仍有 setuptools。

几乎所有涉及使用 yum 下载内容的建议对我都不起作用。百胜总是说找不到我要找的东西。因此,如果有一种方法我可以在没有 yum 或 apt-get 的情况下下载东西(例如,不通过终端),那可能是最好的。

我的机器上同时安装了 Python 3 和 Python 2,所以我不知道这是否会改变你们给我的建议。

1000 感谢任何能提供帮助的人!现在我只能通过 anaconda 界面(例如 Jupyter notebooks 和 Spyder)来完成工作,这真的很有限。

编辑:这是我的错误跟踪:

Traceback (most recent call last):

File "/usr/bin/pip2", line 5, in <module>

from pkg_resources import load_entry_point

File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 947, in <module>

class Environment(object):

File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 951, in Environment

self, search_path=None, platform=get_supported_platform(),

File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 180, in get_supported_platform

plat = get_build_platform()

File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 380, in get_build_platform

from sysconfig import get_platform

ImportError: No module named sysconfig

编辑 2: @hoefling 要求我发布以下命令的输出;第一:

$ yum list installed | grep setuptools
*Note* Red Hat Network repositories are not listed below. You must run this command as root to access RHN repositories.
python-setuptools.noarch 0.6.10-4.el6_9 @ncep-base-x86_64-workstation-6

和:

$ grep ^Version: /usr/lib/python2.6/site-packages/setuptools-*.egg-info/PKG-INFO
grep: /usr/lib/python2.6/site-packages/setuptools-*.egg-info/PKG-INFO: No such file or directory

最佳答案

我在 redHat 服务器 6.9 上使用 python2.6 时遇到了同样的错误:

pip version
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 947, in <module>
class Environment(object):
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 951, in Environment
self, search_path=None, platform=get_supported_platform(),
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 180, in get_supported_platform
plat = get_build_platform()
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 380, in get_build_platform
from sysconfig import get_platform
ImportError: No module named sysconfig

我删除了:

rm /usr/lib/python2.6/site-packages/pkg_resources*

我重新安装了 python-setuptools

yum reinstall python-setuptools

修复后:

pip --version
pip 7.1.0 from /usr/lib/python2.6/site-packages (python 2.6)

关于python - 导入错误 : No module named sysconfig--can't get pip working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50742538/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com