ImportError:没有使用系统python Ubuntu 16.04的名为“ flask” mod_wsgi的模块

时间:2018-12-17 20:48:18

标签: flask ubuntu-16.04 python-3.5

我在系统python3.5安装下安装了flask。运行python shell时,我没有导入问题:

Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
>>> flask.__version__
'1.0.2' 
>>>

Apache错误日志:

mod_wsgi (pid=7058): Target WSGI script '/var/www/AppName/images.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=7058): Exception occurred processing WSGI script '/var/www/AppName/images.wsgi'.
Traceback (most recent call last):
File "/var/www/AppName/images.wsgi", line 5, in <module>
 from app import app as application
File "/var/www/AppName/app.py", line 1, in <module>
 from flask import Flask, render_template, request, redirect, url_for
ImportError: No module named 'flask'

虚拟主机配置:

WSGIDaemonProcess AppName user=USER group=GROUP python-path=/home/USER/.local/bin/python3.5/site-packages
Directory /var/www/AppName>
        WSGIApplicationGroup %{GLOBAL}
        Order deny,allow
        Allow from all
        AuthType Basic
        AuthName "HRApp"
        AuthUserFile "/path/to/passwords"
        Require valid-user
    </Directory>

0 个答案:

没有答案