Jump to content

[Solved] Upgrade django to python 2.7


Guest Geoff

Recommended Posts

Guest Geoff

I would like django to be upgraded to use python 2.7. (On Stevie) This can be done (supposedly) relatively easily.

 

NOTE: Please do not just copy and paste these commands. I have not verified their safeness.

 

1. Install django:

 

cd /django <-- Directory to where django installation files are located
/path/to/python2.7 ./setup.py install

 

2. Install mod_wsgi

 

cd /mod_wsgi <-- Directory to where mod_wsgi installation files are located
./configure --with-python=/path/to/python2.7
make
make install

Link to comment
Share on other sites

I thought djbob already did this? Isn't it something like...

 

#!/usr/bin/python3.2

 

..?

 

Although I don't know any Python myself and I have no idea if that is right. I think it's the same shebang line just with 3.2 on the end.

Link to comment
Share on other sites

Guest Geoff

Djbob had upgraded the version of python. The version of python that django is running is still 2.4.

Link to comment
Share on other sites

Guest Geoff

Uh... Just realized that django is not compatible with python 3.x, so I'll just upgrade it to python 2.7

 

Okay, so django installed without any errors.

 

Then, I configured the makefile with python 2.7:

 

root@stevie [/home/gfishing/mod_wsgi-3.3]# ./configure --with-python="/usr/bin/env python2.7"
checking for apxs2... no
checking for apxs... /usr/bin/apxs
checking Apache version... 2.2.16
configure: creating ./config.status
config.status: creating Makefile

 

 

Looking good so far...

root@stevie [/home/gfishing/mod_wsgi-3.3]# make
/usr/bin/apxs -c -I/usr/local/include/python2.7 -DNDEBUG   mod_wsgi.c -L/usr/local/lib -L/usr/local/lib/python2.7/config  -lpython2.7 -lpthread -ldl  -lutil -lm
/usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic -m64 -fPIC -DPIC  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -m64 -fPIC -DPIC -pthread -I/opt/pcre/include -I/usr/local/apache/include  -I/usr/local/apache/include   -I/usr/local/apache/include  -I/usr/local/include/python2.7 -DNDEBUG  -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
/usr/local/apache/build/libtool --silent --mode=link gcc -o mod_wsgi.la  -rpath /usr/local/apache/modules -module -avoid-version    mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
/usr/bin/ld: /usr/local/lib/libpython2.7.a(node.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1

 

Then it fails.

 

Okay, I've found the problem:

http://code.google.com/p/modwsgi/wiki/Inst...64_Bit_Packages

Link to comment
Share on other sites

I could not find instructions on how to install Python 2.7 as a 64-bit library. I tried to recompile/altinstall Python 2.7 with --enable-shared, but I don't see a .so file in /usr/local/lib/python2.7/config/.

Link to comment
Share on other sites

Guest Geoff

Now I'm getting:

 

./python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared obje

ct file: No such file or directory

 

Hmm... let me see.

 

Okay, here is the problem:

 

./python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared obje
ct file: No such file or directory

 

and here is where that file is:

 

/usr/local/lib/libpython2.7.so.1.0

 

The problem is how to make it pick that file up...

 

-------------------------------------------------------------------------------

 

 

I fixed it! Finally. (Only took a couple hours of googling around)

 

Added /usr/local/lib to ld.so.conf

 

Okay, so python2.7 is working correctly now.

 

And the new python version is loaded:

 

mod_wsgi/3.3 Python/2.7.1 Server

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...