python main.py 出错包导入错误


各位好:
我接手一个网站,现在需要测试启动,目前我在虚拟环境中的软件如下(使用pip freeze查看):


 Flask==0.10.1
Flask-Admin==1.0.7
Flask-Auth==0.85
Flask-OAuth==0.12
Flask-SQLAlchemy==1.0
Jinja2==2.7.2
Mako==0.9.1
Markdown==2.4
MarkupSafe==0.19
SQLAlchemy==0.9.4
WTForms==1.0.5
Werkzeug==0.9.4
alembic==0.6.3
argparse==1.2.1
distribute==0.6.24
httplib2==0.8
ipython==1.2.1
itsdangerous==0.24
nose==1.3.0
oauth2==1.5.211
psycopg2==2.5.2
wsgiref==0.1.2

但是,当我处理python main.py的时候,还是会报出如下错误:
homepage)duqi@Lenovo-G480:~/python/homepage$ python main.py
Traceback (most recent call last):
File "main.py", line 1, in <module>
from homepage import create_app
File "/home/duqi/python/homepage/homepage/ init .py", line 2, in </module> <module>
from homepage import views
File "/home/duqi/python/homepage/homepage/views/ init .py", line 1, in </module> <module>
from home import blueprint_home
File "/home/duqi/python/homepage/homepage/views/home.py", line 6, in </module> <module>
from homepage.helper import render_template, generator_hash
File "/home/duqi/python/homepage/homepage/helper.py", line 5, in </module> <module>
from flask_oauth import Oauth
ImportError: cannot import name Oauth </module>

并且,在helper.py的第5行代码是:


 from flask_oauth import Oauth

flask oauth2 python web oauth

Laggan 10 years, 8 months ago

看看人家 示例 是怎么写的:


 from flask_oauth import OAuth

注意检查拼写,少犯这种低级错误。

Liggil answered 10 years, 8 months ago

Your Answer