ubuntu 管道安装:模块未找到错误:没有名为“compileall”的模块

n53p2ov0  于 2023-03-29  发布在  其他
关注(0)|答案(1)|浏览(135)

我正在使用Apple Virtualization的UTM VM上运行Ubuntu 22.04 LTS ARM。当我运行python -m pip install时,它出错如下:

$ python -m pip install hg-git
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 68, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 109, in create_command
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 14, in <module>
    from pip._internal.cli.req_command import (
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 21, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 32, in <module>
    from pip._internal.req import InstallRequirement
  File "/usr/lib/python3/dist-packages/pip/_internal/req/__init__.py", line 8, in <module>
    from .req_install import InstallRequirement
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 39, in <module>
    from pip._internal.operations.install.wheel import install_wheel
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/install/wheel.py", line 5, in <module>
    import compileall
ModuleNotFoundError: No module named 'compileall'

如何修复此错误?我特别困惑,因为具有相同设置的另一个VM没有此问题。提前感谢!
我在网上找到的解决方案似乎建议通过运行pip install compileall来解决这个问题,但这会导致同样的错误:

$ pip install compileall
Traceback (most recent call last):
  File "/usr/bin/pip", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 68, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 109, in create_command
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 14, in <module>
    from pip._internal.cli.req_command import (
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 21, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 32, in <module>
    from pip._internal.req import InstallRequirement
  File "/usr/lib/python3/dist-packages/pip/_internal/req/__init__.py", line 8, in <module>
    from .req_install import InstallRequirement
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 39, in <module>
    from pip._internal.operations.install.wheel import install_wheel
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/install/wheel.py", line 5, in <module>
    import compileall
ModuleNotFoundError: No module named 'compileall'
ulydmbyx

ulydmbyx1#

你可以按这个顺序试试:python -m pip install compileall2

相关问题