我使用的是sudo pip install pyworld
sudo下的python版本是3.8
报错信息如下
Collecting pyworld Using cached pyworld-0.3.4.tar.gz (251 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting numpy Using cached numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB) Collecting cython>=0.24 Using cached Cython-3.0.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB) Building wheels for collected packages: pyworld Building wheel for pyworld (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for pyworld (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [35 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-cpython-38 creating build/lib.linux-x86_64-cpython-38/pyworld copying pyworld/__init__.py -> build/lib.linux-x86_64-cpython-38/pyworld running build_ext Compiling pyworld/pyworld.pyx because it changed. [1/1] Cythonizing pyworld/pyworld.pyx building 'pyworld.pyworld' extension creating build/temp.linux-x86_64-cpython-38 creating build/temp.linux-x86_64-cpython-38/lib creating build/temp.linux-x86_64-cpython-38/lib/World creating build/temp.linux-x86_64-cpython-38/lib/World/src creating build/temp.linux-x86_64-cpython-38/pyworld x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/cheaptrick.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/cheaptrick.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/codec.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/codec.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/common.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/common.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/d4c.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/d4c.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/dio.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/dio.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/fft.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/fft.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/harvest.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/harvest.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/matlabfunctions.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/matlabfunctions.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/stonemask.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/stonemask.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/synthesis.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/synthesis.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c lib/World/src/synthesisrealtime.cpp -o build/temp.linux-x86_64-cpython-38/lib/World/src/synthesisrealtime.o x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ilib/World/src -I/tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c pyworld/pyworld.cpp -o build/temp.linux-x86_64-cpython-38/pyworld/pyworld.o pyworld/pyworld.cpp:58:10: fatal error: Python.h: 没有那个文件或目录 58 | #include "Python.h" | ^~~~~~~~~~ compilation terminated. /tmp/pip-build-env-c2e52bah/overlay/lib/python3.8/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-yf9p1a3j/pyworld_21f8572cc2604b23959395495105a2c9/pyworld/pyworld.pyx tree = Parsing.p_module(s, pxd, full_module_name) error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pyworld Failed to build pyworld ERROR: Could not build wheels for pyworld, which is required to install pyproject.toml-based projects
解决方法
sudo apt-get install libpython3.8-dev
再重新安装