我在安装了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('"'"'rn'"'"', '"'"'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('"'"'rn'"'"', '"'"'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('"'"'rn'"'"', '"'"'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.
我在Python中安装包时已经尝试了Deprecated wheel错误。pip install https://github.com/aboSamoor/pycld2/zipball/e3ac86ed4d4902e912691c1531d0c5645382a726
不工作。我收到了完全相同的错误。
谢谢你的建议。
解决方案是运行sudo apt-get install python3.X-dev
其中X是您设备的python版本。
更多细节和其他可能的解决方案可在https://askubuntu.com/questions/1219870/error-command-x86-64-linux-gnu-gcc-failed-with-exit-status-1-for-lssl-and-lc
找到