【发布时间】:2021-08-10 11:35:00
【问题描述】:
我在安装了 Ubuntu2004 的 WSL2 环境中工作。我需要安装 pycld2 作为 multi_rake 的先决条件。尝试安装 pycld2 我收到以下错误:
Defaulting to user installation because normal site-packages is not writeable
Collecting pycld2
Using cached pycld2-0.41.tar.gz (41.4 MB)
Building wheels for collected packages: pycld2
Building wheel for pycld2 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/setup.py'"'"'; __file__='"'"'/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-h8_snz7d
cwd: /tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/
Complete output (24 lines):
running bdist_wheel
The [wheel] section is deprecated. Use [bdist_wheel] instead.
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/pycld2
copying pycld2/__init__.py -> build/lib.linux-x86_64-3.9/pycld2
running build_ext
building 'pycld2._pycld2' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/tmp
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/internal
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/internal -I/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/public -I/usr/include/python3.9 -c /tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/encodings.cc -o build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/encodings.o -w -O2 -m64 -fPIC
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/internal -I/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/public -I/usr/include/python3.9 -c /tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/pycldmodule.cc -o build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/pycldmodule.o -w -O2 -m64 -fPIC
/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/pycldmodule.cc:16:10: fatal error: Python.h: No such file or directory
16 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for pycld2
Running setup.py clean for pycld2
Failed to build pycld2
Installing collected packages: pycld2
Running setup.py install for pycld2 ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/setup.py'"'"'; __file__='"'"'/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-b9yh8_sb/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/d022785/.local/include/python3.9/pycld2
cwd: /tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/
Complete output (23 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/pycld2
copying pycld2/__init__.py -> build/lib.linux-x86_64-3.9/pycld2
running build_ext
building 'pycld2._pycld2' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/tmp
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2
creating build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/internal
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/internal -I/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/public -I/usr/include/python3.9 -c /tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/encodings.cc -o build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/encodings.o -w -O2 -m64 -fPIC
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/internal -I/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/cld2/public -I/usr/include/python3.9 -c /tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/pycldmodule.cc -o build/temp.linux-x86_64-3.9/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/pycldmodule.o -w -O2 -m64 -fPIC
/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/bindings/pycldmodule.cc:16:10: fatal error: Python.h: No such file or directory
16 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/setup.py'"'"'; __file__='"'"'/tmp/pip-install-72wuvdta/pycld2_4eb9541bed8f48ca9f3ef7c3d9e695e6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-b9yh8_sb/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/d022785/.local/include/python3.9/pycld2 Check the logs for full command output.
我已经尝试过Deprecated wheel error when installing package in Python。pip install https://github.com/aboSamoor/pycld2/zipball/e3ac86ed4d4902e912691c1531d0c5645382a726
不工作。我收到完全相同的错误。
感谢任何建议。
【问题讨论】: