有谁能给我一套关于在Ubuntu for Python 3上安装mod_wsgi的清晰说明吗?
我确实得到了Flask&;mod_wsgi成功地使用了Python3,并在一瞬间感到高兴.
...直到我看了Apache的日志(log),意识到我遇到了这个问题: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日志(log)中出现错误.(Should I report this and if so where?)
在链接中,工程师正在使用pip
来安装更为更新的版本.
有趣的是,他似乎正在把它安装到一个虚拟的Python3环境中.(这与使用system pip3
有什么不同吗?)
他还使用pip3 install mod_wsgi
,但返回pip3 search mod_wsgi
:
(EDIT: no he doesn't, he uses pip not pip3. Can that be right? Has he got his wires crossed? Isn't pip going to ignore the fact that he is in his py3venv and simply use the system's py2 installation? But anyway that doesn't resolve the confusion...)
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
次,编译大约需要5分钟:
(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
现在成功完成.
编辑:但现在我完全没有按照他的指示go 做:我没有/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
个
又一次沉溺于科技,有人能给我一句台词吗?