【问题标题】:Installation pycld2 fails on wsl2 ubuntu2004在 wsl2 ubuntu2004 上安装 pycld2 失败
【发布时间】: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
不工作。我收到完全相同的错误。

感谢任何建议。

【问题讨论】:

    标签: python linux wsl-2


    【解决方案1】:

    解决方案是运行
    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找到

    【讨论】:

      猜你喜欢
      • 2020-12-20
      • 2021-03-16
      • 1970-01-01
      • 1970-01-01
      • 2020-11-18
      • 2020-07-07
      • 2021-04-24
      • 2020-09-16
      • 2013-05-07
      相关资源
      最近更新 更多