Pygame 已安装在 Ubuntu 18.04 上,但无法在 Itellij 中使用

Pygame 已安装在 Ubuntu 18.04 上,但无法在 Itellij 中使用

我正在尝试使用 pygame 制作游戏。我今天设法安装了 pygame 和 python 3.8。但 Intellij 无法识别该软件包或让我安装它。我收到一条错误消息,import pygame提示No module named pygame

:~$ python3 -m pip install -U pygame --user
Collecting pygame
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/8e/24/ede6428359f913ed9cd1643dd5533aefeb5a2699cc95bea089de50ead586/pygame-1.9.6-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.6
:~$ python3 -m pygame.examples.aliens
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html

但是当我尝试在 intellij 中安装 pygame 时收到此消息

     https://github.com/pypa/pip/issues/8333.
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pycharm-packaging/pygame/setup.py'"'"'; __file__='"'"'/tmp/pycharm-packaging/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-g85mo6rw
       cwd: /tmp/pycharm-packaging/pygame/
 <Lines Omitted For Brevity>
src_c/_pygame.h:85:10: fatal error: Python.h: No such file or directory
         #include <Python.h>
              ^~~~~~~~~~

相关内容