Using Mod_wsgi with Anaconda python library

2019-07-27 03:13发布

问题:

I have install mod_wsgi --with-python option. When i am running flask app on apache it is saying "No module name flask" Flask is already installed in anaconda. How can i force mod_wsgi to pick up the anaconda libraries.

回答1:

You probably need to do the following.

When you are building mod_wsgi from source code, set the LD_RUN_PATH environment variable to /home/jdnco/anaconda2/lib. Thus go back and do something like the following in mod_wsgi source code:

make distclean
./configure --with-python=/home/jdnco/anaconda2/bin/python
LD_RUN_PATH=/home/jdnco/anaconda2/lib make
sudo make install

This will ensure it is linking with the correct library. Check with ldd again.

Then in the Apache configuration file also set:

WSGIPythonHome /home/jdnco/anaconda2

Both of these is necessary when using a Python installation in a non standard location which matches version in system directories.