{"id":797,"date":"2013-08-01T00:00:00","date_gmt":"2013-08-01T00:00:00","guid":{"rendered":"https:\/\/fir3netwp.gmsrrpobkbd.com\/2013\/08\/01\/how-do-i-compile-modwgsi-for-python-27\/"},"modified":"2021-07-31T17:14:42","modified_gmt":"2021-07-31T17:14:42","slug":"how-do-i-compile-modwgsi-for-python-27","status":"publish","type":"post","link":"https:\/\/www.fir3net.com\/Programming\/Python\/how-do-i-compile-modwgsi-for-python-27.html","title":{"rendered":"How do I compile mod_wgsi for Python 2.7"},"content":{"rendered":"
Recently I found myself in a situation where I needed to recompile mod_wgsi against a newer version of Python.<\/p>\n
This involves recompiling Python with the correct flags, then recompiling mod_wsgi using the newly compiled Python. Below shows the steps,<\/p>\n
First of all check what version of Python mod_wsgi was compiled with.<\/p>\n
[root@server]# ldd \/usr\/lib64\/httpd\/modules\/mod_wsgi.so <\/p>\n Next, compile Python. The option to build a shared library is also used to prevent future issues (details can be found here<\/a>).<\/p>\n yum groupinstall “Development tools” cd ~ .\/configure –enable-shared –with-threads Once you have complete these steps you may get the error,<\/p>\n There are 2 ways to fix this. You can :<\/p>\n 1. run ‘echo export LD_LIBRARY_PATH=\/usr\/local\/lib >> \/etc\/profile’ or<\/p>\n 2. configure the following softlinks<\/p>\n ln -s \/usr\/local\/lib\/libpython2.7.so.1.0 \/usr\/lib\/ <\/p>\n Finally we compile wsgi,<\/p>\n cd ~ .\/configure\u00a0 –with-python=\/usr\/local\/bin\/python2.7 <\/p>\n http:\/\/stackoverflow.com\/questions\/7880454\/python-executable-not-finding-libpython-shared-library<\/a><\/p>\n","protected":false},"excerpt":{"rendered":" Recently I found myself in a situation where I needed to recompile mod_wgsi against a newer version of Python. This involves recompiling Python with the correct flags, then recompiling mod_wsgi using the newly compiled Python. Below shows the steps, Check Version First of all check what version of Python mod_wsgi was compiled with. [root@server]# ldd … Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"yoast_head":"\n
\nlibpython2.4.so.1.0<\/strong><\/span> => \/usr\/lib64\/libpython2.4.so.1.0 (0x00002b3149c4e000)
\nlibpthread.so.0 => \/lib64\/libpthread.so.0 (0x00002b3149f82000)
\nlibdl.so.2 => \/lib64\/libdl.so.2 (0x00002b314a19d000)
\nlibutil.so.1 => \/lib64\/libutil.so.1 (0x00002b314a3a2000)
\nlibm.so.6 => \/lib64\/libm.so.6 (0x00002b314a5a5000)
\nlibc.so.6 => \/lib64\/libc.so.6 (0x00002b314a828000)
\n\/lib64\/ld-linux-x86-64.so.2 (0x000000364b200000)<\/p>\nCompile Python<\/strong><\/h2>\n
\nyum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel<\/p>\n
\nwget http:\/\/www.python.org\/ftp\/python\/2.7.5\/Python-2.7.5.tgz<\/a>
\ntar xvf Python-2.7.5.tgz
\ncd Python-2.7.5<\/p>\n
\nmake
\nmake install<\/p>\n
\nln -s \/usr\/local\/lib\/libpython2.7.so \/usr\/<\/p>\nCompile WSGI<\/strong><\/h2>\n
\nwget
\ntar xvf mod_wsgi-3.4.tar.gz
\ncd mod_wsgi-3.4<\/p>\n
\nmake
\nmake install<\/p>\nReferences<\/strong><\/h2>\n