mod_wsgi runtime using old python version
<p>I'm running a django server on httpd service.
I had to upgrade my python version(2.7.12).
After installing the new python I rebuild the mod_wsgi with the new python (using with-python argument).
I also rebuild the mod_python with the new python version.
My new python path is /usr/local/bin/python2.7.
In the /etc/httpd/conf.d/django.conf I added the following line :
WSGIPythonHome /usr/local.</p>

<p>However I see this error in my error_log file (httpd error log):</p>

<pre><code>[Tue Sep 20 12:32:12.743338 2016] [:warn] [pid 8567:tid 139972130834496]    mod_wsgi: Compiled for Python/2.7.12. 
[Tue Sep 20 12:32:12.743376 2016] [:warn] [pid 8567:tid 139972130834496]    mod_wsgi: Runtime using Python/2.7.5.
</code></pre>

<p>What i'm missing ?</p>

<p>FYI : I cannot change or redirect the default python that exists in /usr/bin/python because this affect centos package management.</p>

<p>When you install a Python version of the same X.Y version as system Python, but different patch level, you need to force the runtime linker to use the shared Python library from the alternate location of your newer Python version.</p>

<p>To do this, go back and rebuild mod_wsgi but set the <code>LD_RUN_PATH</code> environment variable when building mod_wsgi, to the directory containing the Python library for the alternate Python version.</p>

<pre><code>make distclean
./configure --with-python=/usr/local/bin/python2.7
LD_RUN_PATH=/usr/local/lib make
sudo make install
</code></pre>

<p>If this works correctly, you should be able to run:</p>

<pre><code>ldd mod_wsgi.so
</code></pre>

<p>on the <code>mod_wsgi.so</code> file that was installed and it should be using the Python library from <code>/usr/local/lib</code> and not <code>/usr/lib</code>.</p>

<p>You will also need to still set:</p>

<pre><code>WSGIPythonHome /usr/local
</code></pre>

python django apache mod-wsgi