用 Cython 编译 python3 脚本 | CentOs 6.x

Compile python3 script with Cython | CentOs 6.x

我之前在 ubuntu 上用 cython 编译了脚本,它在所有 ubuntu os 上都运行良好,但它在 centos 上不起作用,它失败了出现此错误:error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory.

所以我尝试在 centos 上编译脚本,但是当我尝试使用以下命令编译 Cython 生成的 C 源代码时 gcc -Os -I /usr/include/python3.6m -o a.o script.c -lpython3.6m -lpthread -lm -lutil -ldl 我收到此错误 script.c:4:20: error: Python.h: No such file or directory script.c:6:6: error: #error Python headers needed to compile C extensions, please install development version of Python.

我试过安装 python3 开发库,但 CentOs 6 似乎没有它们,并搜索有同样问题的人,但到目前为止我还没有找到任何有用的东西。 我想我可以通过安装 python3-devel.

来解决问题

解决方案https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-centos-7

对于 centos 6 安装 ius repo 是这样的: 百胜安装 https://repo.ius.io/ius-release-el6.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm -y (source: https://ius.io/setup)