原问题:

/usr/local/lib/libpython3.7m.a(call.o): relocation R_X86_64_32 against `.rodata.str1.8’ can not be used when making a shared object; recompile with -fPIC

大意就是目前这个python3.7的库是个静态库,不是所需要的动态库,需要重新编译一遍python

解决方法

首先cd到你的python3.7的解压文件夹下,也就是你安装包的文件夹

然后配置并编译

$ ./configure --prefix=/usr/local/  --enable-shared CFLAGS=-fPIC
$ make clean
$ make && sudo make install

现在,你可以在你的/usr/local/lib目录下找到新的动态库了(libpython3.7m.so),它就是所需要的

然后将地址/usr/local/lib添加到链接目录即可

LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial /usr/lib/x86_64-linux-gnu
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐