我正在尝试构建uwsgi + django服务器。我需要使用以下命令为python3.6构建uwsgi python36_plugin.so:
make PROFILE=nolang
PYTHON=python3 ./uwsgi --build-plugin "plugins/python python36"
它不起作用:
[root@izuf64a9gck81cz uwsgi-2.0.15]# PYTHON=python ./uwsgi --build-plugin "plugins/python python36"
*** uWSGI building and linking plugin from plugins/python ***
[gcc -pthread] python36_plugin.so
/usr/bin/ld: /usr/python3/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/python3/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
*** unable to build python36 plugin ***
当我使用build python2.7版本时,结果是正确的
PYTHON=python2.7 ./uwsgi --build-plugin "plugins/python python27"
答案 0 :(得分:0)
我的问题是我有两个版本的python 3,默认的python3是python3.4,第二个是python3.6,我想在我的django项目中使用python3.6,所以我需要构建插件,我遇到了同样的问题。
我花了几个小时解决了这个问题。这是我在here中所做的事情:
cd Python-3.6.4/
./configure --enable-shared --enable-optimizations --prefix=/usr/local LDFLAGS="-Wl,--rpath=/usr/local/lib"
PYTHON=python3.6 ./uwsgi --build-plugin "plugins/python python36"
祝你好运!也可以解决您的问题!