我遵循django教程和mod_wsgi安装指南在LinuxMint18.1上使用Apache和mod_wsg,但是当我运行apache2ctl start时出现错误。在Linux上使用mod_wsgi时为什么发生错误?
Current thread 0x00007f88c10c7780 (most recent call first):
[Mon Mar 20 21:23:28.781270 2017] [core:notice] [pid 32458:tid 140225331099520] AH00052: child pid 7962 exit signal Aborted (6)
Fatal Python error: Py_Initialize: can't initialize sys
我怎么了?
我按照下面的步骤来安装Apache和mod_wsgi的:
- 易于得到安装的Apache2
- 的apt-get安装的apache2-dev的
- 的apt-get安装python3.5-dev的
- wget的https://github.com/GrahamDumpleton/mod_wsgi/archive/4.5.15.tar.gz
- 焦油-zxvf mod_wsgi的-4.5.15.tar.gz
- CD mod_wsgi的-4.5.15
- 的./configure --with-蟒=的/ usr /斌/ python3.5
- 使
- 使安装
的ls /usr/bin/ -aoh |grep python
输出是:
lrwxrwxrwx 1 root 26 3月 18 09:40 dh_pypy -> ../share/dh-python/dh_pypy
-rwxr-xr-x 1 root 1.1K 12月 10 2015 dh_python2
lrwxrwxrwx 1 root 29 3月 18 09:40 dh_python3 -> ../share/dh-python/dh_python3
lrwxrwxrwx 1 root 23 3月 18 09:40 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx 1 root 23 3月 18 09:40 pdb3.5 -> ../lib/python3.5/pdb.py
lrwxrwxrwx 1 root 31 3月 18 09:40 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx 1 root 26 3月 18 09:40 pybuild -> ../share/dh-python/pybuild
lrwxrwxrwx 1 root 18 3月 20 18:36 python -> /usr/bin/python2.7
lrwxrwxrwx 1 root 9 3月 18 09:40 python2 -> python2.7
-rwxr-xr-x 1 root 3.4M 11月 19 17:35 python2.7
lrwxrwxrwx 1 root 9 3月 18 09:40 python3 -> python3.5
-rwxr-xr-x 1 root 4.3M 11月 18 03:23 python3.5
lrwxrwxrwx 1 root 33 11月 18 03:23 python3.5-config -> x86_64-linux-gnu-python3.5-config
-rwxr-xr-x 1 root 4.3M 11月 18 03:23 python3.5m
lrwxrwxrwx 1 root 34 11月 18 03:23 python3.5m-config -> x86_64-linux-gnu-python3.5m-config
lrwxrwxrwx 1 root 10 3月 18 09:40 python3m -> python3.5m
lrwxrwxrwx 1 root 29 3月 18 09:40 pyversions -> ../share/python/pyversions.py
lrwxrwxrwx 1 root 34 11月 18 03:23 x86_64-linux-gnu-python3.5-config -> x86_64-linux-gnu-python3.5m-config
-rwxr-xr-x 1 root 3.2K 11月 18 03:20 x86_64-linux-gnu-python3.5m-config
/etc/apache2/apache2.conf
:
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
WSGIScriptAlias//home/jeffrey/桌面/Workspace/django-env/hello_django/hello_django/wsgi.py
WSGIPythonHome /home/jeffrey/桌面/Workspace/django-env
WSGIPythonPath /home/jeffrey/桌面/Workspace/django-env/hello_django
<Directory /home/jeffrey/桌面/Workspace/django-env/hello_django/hello_django>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
项目文件结构:
django-env
├── hello_django
│ ├── hello_django
│ │ └── wsgi.py
您使用的是virtualenv吗?什么是httpd.conf和你的wsgi文件的适当部分? –
这通常表示您已经使用非标准位置中的Python安装从源代码构建了mod_wsgi,但是在系统中安装了具有相同主/次版本的Python版本,并且它正在拾取错误的Python共享库。详细说明您正在使用的Python版本以及它的安装位置。 –
@GrahamDumpleton我有详细的问题,你可以看看它吗? – Jeffery