将Mod_wsgi与Anaconda python库

时间:2016-10-20 10:11:40

标签: python apache flask anaconda mod-wsgi

我安装了mod_wsgi --with-python选项。 当我在apache上运行flask app时,它说'#34;没有模块名称烧瓶" Flask已安装在anaconda中。 我怎么能强迫mod_wsgi拿起anaconda库。

1 个答案:

答案 0 :(得分:2)

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.