Python Pycharm 在 Ubuntu 上从 pypi 安装软件包时出错

Python Pycharm error while installing packages from pypi on Ubuntu

我不知道该怎么办。没有软件包能够安装。如果有任何相关性,我会在 Ubuntu 上。第一张图片显示了我的设置,选择了解释器

这是我尝试安装(包上方的“+”)numpy 时发生的情况。其他包都一样。

当我点击“详细信息”时,我得到这个命令输出:

Error: Traceback (most recent call last):
  File "/snap/pycharm-community/274/plugins/python-ce/helpers/packaging_tool.py", line 73, in run_pip
    runpy.run_module(module_name, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/__main__.py", line 29, in <module>
    from pip._internal.cli.main import main as _main
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._internal.cli.parser import ConfigOptionParser
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
    from pip._internal.configuration import Configuration, ConfigurationError
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/configuration.py", line 26, in <module>
    from pip._internal.utils.logging import getLogger
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 13, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 40, in <module>
    from pip._internal.locations import get_major_minor_version, site_packages, user_site
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 14, in <module>
    from . import _distutils, _sysconfig
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/locations/_distutils.py", line 9, in <module>
    from distutils.cmd import Command as DistutilsCommand
ModuleNotFoundError: No module named 'distutils.cmd'

这是我的“管理存储库”中的内容

我也试过直接从命令行安装,但没有成功。

如果有人对如何解决这个问题有任何建议,我将不胜感激。

似乎缺少 python3-distutils apt 包。

您可以尝试使用 sudo apt install python3-distutils

安装

之后可能需要重新创建 venv。这应该可以通过 PyCharm.