简体   繁体   English

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

[英]Python Pycharm error while installing packages from pypi on Ubuntu

I don't know what to do.我不知道该怎么办。 No package is able to install.没有package能够安装。 I am on Ubuntu if it is of any relevance.如果有任何相关性,我正在拨打 Ubuntu。 First image shows my settings, selected interpreter第一张图片显示我的设置,选择的解释器第一张图片

Here is what happens when I try to install ("+" above Package) numpy. It is the same for any other package.这是我尝试安装(包上方的“+”)numpy 时发生的情况。其他任何 package 都一样。

在此处输入图像描述

When I click on "Details" I get this command output:当我点击“详细信息”时,我得到这个命令 output:

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'

This is what is in my "Manage repositories"这是我的“管理存储库”中的内容

在此处输入图像描述

I also tried installing directly from command line with no luck.我也尝试过直接从命令行安装,但没有成功。

在此处输入图像描述

If anyone has any suggestions on how to solve this issue, I'd greatly appreciate it.如果有人对如何解决此问题有任何建议,我将不胜感激。

Looks like the python3-distutils apt package is missing.看起来缺少python3-distutils apt package。

You can try installing it with sudo apt install python3-distutils您可以尝试使用sudo apt install python3-distutils安装它

It might be necessary to recreate the venv afterwards.之后可能需要重新创建 venv。 That should be possible through PyCharm.这应该可以通过 PyCharm 实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM