为什么 pip 在 Monaro linux 上无法工作,即使我正确安装了它?

问题描述 投票:0回答:1

在我尝试从

/home/pc/.local/
等手动卸载葡萄汁(roblox studio/player)后,我试图安装枕头包。它给出了这个错误:

`Traceback (most recent call last):
  File "/usr/bin/pip", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/pip/_internal/cli/main.py", line 78, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pip/_internal/commands/__init__.py", line 114, in create_command
    module = importlib.import_module(module_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/pip/_internal/commands/install.py", line 16, in <module>
    from pip._internal.cli.req_command import (
  File "/usr/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 19, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/usr/lib/python3.12/site-packages/pip/_internal/index/package_finder.py", line 31, in <module>
    from pip._internal.req import InstallRequirement
  File "/usr/lib/python3.12/site-packages/pip/_internal/req/__init__.py", line 9, in <module>
    from .req_install import InstallRequirement
  File "/usr/lib/python3.12/site-packages/pip/_internal/req/req_install.py", line 40, in <module>
    from pip._internal.operations.install.wheel import install_wheel
  File "/usr/lib/python3.12/site-packages/pip/_internal/operations/install/wheel.py", line 40, in <module>
    from pip._vendor.distlib.scripts import ScriptMaker
  File "/usr/lib/python3.12/site-packages/pip/_vendor/distlib/scripts.py", line 16, in <module>
    from .compat import sysconfig, detect_encoding, ZipFile
  File "/usr/lib/python3.12/site-packages/pip/_vendor/distlib/compat.py", line 81, in <module>
    import xmlrpc.client as xmlrpclib
  File "/usr/lib/python3.12/xmlrpc/client.py", line 138, in <module>
    from xml.parsers import expat
  File "/usr/lib/python3.12/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: /usr/lib/python3.12/lib-dynload/pyexpat.cpython-312-x86_64-linux-gnu.so: undefined symbol: XML_SetReparseDeferralEnabled
`

我该如何修复它?

我尝试使用chatgpt,但我认为它不起作用

python linux pip console
1个回答
0
投票

1.检查您的Python版本: 确保您使用兼容的 Python 版本。错误消息提到 Python 3.12,它不是官方的 Python 版本。通过运行 python3 --version 检查系统上安装的 Python 版本。

2.更新您的系统软件包: 尝试更新系统软件包,包括软件包管理器(例如 apt、yum、dnf)和 pip 软件包。这可能有助于解决任何潜在的兼容性问题。

更新包管理器

sudo apt-get 更新 sudo apt-get 升级

更新点

python3 -m pip install --升级 pip

  1. 如果失败重新安装Python
© www.soinside.com 2019 - 2024. All rights reserved.