uwsgi无法为python3.6构建plugin.so

问题描述 投票:1回答:1

我正在尝试构建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"
python uwsgi
1个回答
0
投票

我的问题是我有两个版本的python 3,默认的python3是python3.4,第二个是python3.6,我想在我的django项目中使用python3.6所以我需要构建插件和我遇到了同样的问题。

我花了几个小时来解决这个问题。这是我从here做的:

  1. 重新配置我的python3.6

cd Python-3.6.4/ ./configure --enable-shared --enable-optimizations --prefix=/usr/local LDFLAGS="-Wl,--rpath=/usr/local/lib"

  1. 进入你的uwsgi文件夹并尝试再次构建

PYTHON=python3.6 ./uwsgi --build-plugin "plugins/python python36"

祝好运!愿它解决你的问题吧!

© www.soinside.com 2019 - 2024. All rights reserved.