Linux 安装sasl遇到错误


× Running setup.py install for sasl3 did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      /opt/moudle/anaconda/envs/pyspark/lib/python3.8/site-packages/setuptools/dist.py:770: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      running install
      /opt/moudle/anaconda/envs/pyspark/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/sasl
      copying sasl/__init__.py -> build/lib.linux-x86_64-cpython-38/sasl
      running egg_info
      writing sasl3.egg-info/PKG-INFO
      writing dependency_links to sasl3.egg-info/dependency_links.txt
      writing requirements to sasl3.egg-info/requires.txt
      writing top-level names to sasl3.egg-info/top_level.txt
      reading manifest file 'sasl3.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE.txt'
      writing manifest file 'sasl3.egg-info/SOURCES.txt'
      copying sasl/saslwrapper.cpp -> build/lib.linux-x86_64-cpython-38/sasl
      copying sasl/saslwrapper.h -> build/lib.linux-x86_64-cpython-38/sasl
      copying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-cpython-38/sasl
      running build_ext
      building 'sasl.saslwrapper' extension
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/sasl
      gcc -pthread -B /opt/moudle/ac/envs/pyspark/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/opt/moudle/ac/envs/pyspark/include/python3.8 -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-cpython-38/sasl/saslwrapper.o
      cc1plus: 警告:command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [默认启用]
      sasl/saslwrapper.cpp:4:20: 致命错误:Python.h:没有那个文件或目录
       #include "Python.h"
                          ^
      编译中断。
      error: command '/usr/bin/gcc' failed with exit code 1

这种问题要怎么解决,尝试过使用yum install python3_devel 安装,但还是报这样的错误

参考GPT和自己的思路:

这个错误的原因是缺少Python.h文件。你可以尝试安装python3_devel,如果yum安装失败,可以尝试使用apt-get命令,命令如下:

sudo apt-get install python3-dev

如果使用apt-get安装不起作用,你可以在终端运行以下命令:

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install python3-dev

这将安装编译所需的关键包以及Python开发工具包。在安装后,你需要重新运行sasl3安装。希望这可以帮助你解决问题。

sudo apt-get install python-dev 把 python.h 安装上