python, pyenv and recompiling to handle a 64bit is

2019-08-03 07:18发布

问题:

I have pyenv, and i want to use python 3.4.1 against apache.

To that end, I have installed mod_wsgi 4.2.7

In compiling mod_wsgi, I get the following error:

Object_NextNotImplemented' can not be used when making a shared object; recompile with -fPIC
/root/.pyenv/versions/3.4.1/lib/libpython3.4m.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [src/server/mod_wsgi.la] Error 1

According to this page the issue is something to do with a 64bit or a 32 bit or... I don't know.

Anyway, the solution is to re-compile python with some sort of flag.

How do i resolve this issue, bearing in mind that i am using pyenv?

回答1:

This is not the solution, i still get the same error after having done this

PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs4 --enable-shared" 
pyenv uninstall 3.4.1
pyenv install 3.4.1

so the first line - i didn't think would actually work, I don't know what it is doing. I guess it is just setting some magic system variable somewhere? Oh well, it is doing that.

I don't know what the unicode bit does - this was all suggested in this link here.

Becuase i am wanting to use python 3.4.1, and because it already exists, i then uninstall python 3.4.1

Then i reinstall python 3.4.1

If you wanted to do the same with python x.y.z, you would similarly have

PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs4 --enable-shared" 
pyenv uninstall x.y.z
pyenv install x.y.z

If you had not installed x.y.z python earlier, um, then you wouldn't need to uninstall it.

This whole installation process takes... a while. I started writing this answer right after i kicked off the install command, and it only recently finished.

On finishing i get

WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Installed Python-3.4.1 to /root/.pyenv/versions/3.4.1

But i don't know if that is bad or good. The prompt itself doesn't seem to know either, what with all those question marks around.