ImportError:没有名为'flask'python3 ubuntu 16.04的模块

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

标签: python flask ubuntu-16.04

< mod_wsgi cannot import flask. 

我没有将烧瓶安装在virtualenv下。我可以使用python shell导入烧瓶。我编辑了virtualhost配置,以包含WSGIDaemonProcess HRApp user=USER group=GROUP python-path=/home/USER/.local/bin/python3.5/site-packages无济于事。我想念什么?

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配置:

    WSGIDaemonProcess HRApp user=USER group=GROUP python-path=/home/USER/.local/bin/python3.5/site-packages
    WSGIScriptAlias / /path/to/file.wsgi

    <Directory /var/www/appname>
            WSGIApplicationGroup %{GLOBAL}
            Order deny,allow
            Allow from all
            AuthType Basic
            AuthName "USER"
            AuthUserFile "/passwords_file"
            Require valid-user
    </Directory>

1 个答案:

答案 0 :(得分:0)

通过在Flask应用程序的根文件夹中安装virtualenv,然后使用WSGIPythonHome将mod_wsgi指向python安装解决了该问题。