I\'m on CentOS and trying to configure Apache to use mod_wsgi compiled against Anaconda Python 3.5. Compiling mod_wsgi seems to go OK:
sudo yum inst
That means that the library libpython3.5m.so.1.0
can't be found at runtime because the directory /opt/anaconda/anaconda3/lib
is not a place where the dynamic linker would look for it.
You can try to rebuild mod_wsgi using:
./configure LDFLAGS='-Wl,-rpath=/opt/anaconda/anaconda3/lib' --with-python=/opt/anaconda/anaconda3/bin/python
That will save the library path within the generated binary.
The other option would be to set the LD_LIBRARY_PATH
environment variable for the apache process, which is not really a good method.
Or add the directory /opt/anaconda/anaconda3/lib to the library search path using a conf file in /etc/ld.so.conf.d/, that would be a global setting tough. See man ld-linux for more info.
Also, don't forget to correctly set the WSGIPythonHome
directive in your config file.
edit:
I've done some experimenting and I could reproduce your second error message when the python3
binary is not found on the PATH
.
In that case it seems setting the WSGIPythonHome
directive is not enough, you need to set the PYTHONHOME
environment variable before apache is started, or change PATH
so the interpreter can be found. On CentOS changing /etc/sysconfig/httpd
should do the trick, just add:
export PYTHONHOME=/opt/anaconda/anaconda3
# alternatively this should also work:
export PATH="$PATH:/opt/anaconda/anaconda3/bin"
Or create a symlink to the interpreter in a directory on the path, e.g. /usr/local/bin
...
For reference, an extended explanation why this is needed can be found here