无法编译“ Python.h”。当我键入pip install pretty_midi时,在Msys2中显示

时间:2018-11-10 17:40:02

标签: python numpy pip msys2

我正在Windows8.1上使用MSYS2(Mingw-w64 64位)。
然后我尝试安装pretty_midi,这是一个用于midi操作的python软件包。

首先,我输入

pacman -Ss pretty_midi

,但没有回复。 所以我输入

pip install pretty_midi

然后出现许多消息,最后,

    removing: _configtest.c _configtest.o
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-a_6erlui/numpy/setup.py", line 403, in <module>
    setup_package()
  File "/tmp/pip-install-a_6erlui/numpy/setup.py", line 395, in setup_package
    setup(**metadata)
  File "/tmp/pip-install-a_6erlui/numpy/numpy/distutils/core.py", line 169, in setup
    return old_setup(**new_attr)
  File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 140, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/tmp/pip-install-a_6erlui/numpy/numpy/distutils/command/install.py", line 62, in run
    r = self.setuptools_run()
  File "/tmp/pip-install-a_6erlui/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run
    return distutils_install.run(self)
  File "/usr/lib/python3.7/distutils/command/install.py", line 545, in run
    self.run_command('build')
  File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/tmp/pip-install-a_6erlui/numpy/numpy/distutils/command/build.py", line 47, in run
    old_build.run(self)
  File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/tmp/pip-install-a_6erlui/numpy/numpy/distutils/command/build_src.py", line 148, in run
    self.build_sources()
  File "/tmp/pip-install-a_6erlui/numpy/numpy/distutils/command/build_src.py", line 165, in build_sources
    self.build_extension_sources(ext)
  File "/tmp/pip-install-a_6erlui/numpy/numpy/distutils/command/build_src.py", line 324, in build_extension_sources
    sources = self.generate_sources(sources, ext)
  File "/tmp/pip-install-a_6erlui/numpy/numpy/distutils/command/build_src.py", line 377, in generate_sources
    source = func(extension, build_dir)
  File "numpy/core/setup.py", line 422, in generate_config_h
    moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
  File "numpy/core/setup.py", line 48, in check_types
    out = check_types(*a, **kw)
  File "numpy/core/setup.py", line 281, in check_types
    "install {0}-dev|{0}-devel.".format(python))
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-a_6erlui/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-dka2y2vl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-a_6erlui/numpy/

系统尝试安装numpy,因此

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

它停止了。 我搜索了python-dev,但是在pacman中似乎没有对应的软件包。

我在Google上搜索了很多,但找不到确切答案。
我该如何解决,然后在MSYS2系统上安装pretty_midi?

谢谢。

0 个答案:

没有答案