谁能给我一套在 Ubuntu for Python 3 上安装 mod_wsgi 的清晰说明?
我确实使用 Python3 成功获得了 Flask 和 mod_wsgi,并且短暂地感到高兴。
...直到我查看 Apache 的日志并意识到我遇到了这个问题:https://askubuntu.com/questions/569550/assertionerror-using-apache2-and-libapache2-mod-wsgi-py3-on-ubuntu-14-04-python https://askubuntu.com/questions/569550/assertionerror-using-apache2-and-libapache2-mod-wsgi-py3-on-ubuntu-14-04-python
apt-get
正在安装过时的版本libapache2-mod-wsgi-py3
这会导致 Apache 日志中出现错误。(我应该报告此事吗?如果报告的话,去哪里报告?)
在链接中,工程师正在使用pip
安装更新的版本。
有趣的是,他似乎正在将其安装到虚拟的 Python3 环境中。 (这与使用系统有什么不同吗?pip3
?)
他还使用pip3 install mod_wsgi
, but pip3 search mod_wsgi
返回:
(编辑:不,他没有,他使用 pip 而不是 pip3。这是对的吗?他的电线交叉了吗?pip 不会忽略他在 py3venv 中的事实并简单地使用系统的 py2 安装吗?但无论如何,这并不能解决混乱......)
mod_wsgi-metrics - Metrics package for Apache/mod_wsgi.
cykooz.recipe.pastewsgi - Buildout recipe to create paste.deploy entry points for mod_wsgi or uwsgi
mod_wsgi-httpd - Installer for Apache httpd web server.
apachemiddleware - Useful Python middleware for use with mod_wsgi deployments
tranchitella.recipe.wsgi - Buildout recipe to create paste.deploy entry points for mod_wsgi
mod_wsgi - Installer for Apache/mod_wsgi.
那么什么是mod_wsgi-httpd
?确定这不是我想要的吗?
最后,任何人都可以提供从源代码安装 mod_wsgi 的链接吗?
编辑:我不明白工程师为什么使用pip install mod_wsgi
而不是pip3 ...
。这肯定是不对的吧?但如果我使用 pip3,我会得到:
pi@PiDroplet:~$ cd web/piFlask
pi@PiDroplet:~/web/piFlask$ source ./venv3/bin/activate
(venv3)
pi@PiDroplet:~/web/piFlask$ pip3 install mod_wsgi
Downloading/unpacking mod-wsgi
Downloading mod_wsgi-4.4.12.tar.gz (991kB): 991kB downloaded
Running setup.py (path:/home/pi/web/piFlask/venv3/build/mod-wsgi/setup.py) egg_info for package mod-wsgi
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/pi/web/piFlask/venv3/build/mod-wsgi/setup.py", line 141, in <module>
'missing Apache httpd server packages.' % APXS)
RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/pi/web/piFlask/venv3/build/mod-wsgi/setup.py", line 141, in <module>
'missing Apache httpd server packages.' % APXS)
RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/pi/web/piFlask/venv3/build/mod-wsgi
Storing debug log for failure in /home/pi/.pip/pip.log
现在我尝试pip3 install mod_wsgi-httpd
,编译大约需要五分钟:
(venv3)
pi@PiDroplet:~/web/piFlask$ pip3 install mod_wsgi-httpd
Downloading/unpacking mod-wsgi-httpd
Downloading mod_wsgi-httpd-2.4.12.5.tar.gz
Running setup.py (path:/home/pi/web/piFlask/venv3/build/mod-wsgi-httpd/setup.py) egg_info for package mod-wsgi-httpd
apr-1.5.2/
apr-1.5.2/config.layout
apr-1.5.2/build.conf
apr-1.5.2/emacs-mode
:
所以现在我担心我的 Py3 virtualenv 中有第二个 Apache。
然而,这确实消除了错误;pip3 install mod_wsgi
现在已成功完成。
编辑:但现在我已经完全摆脱了尝试遵循他的指示:我没有/etc/apache2/mods-available/wsgi_express.load
,如果他建议这样做,那么首先这似乎是任意的,其次是他建议放入其中的文本,即LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi-py34.cpython-34m.so
-- 我的系统上不存在该文件。
我有/etc/apache2/mods-available/wsgi.load
再次陷入技术困境,有人可以给我留言吗?