1

我正在按照这个简单的示例来设置一个 OAuth 简单的应用程序,但是发生了一些非常奇怪的事情:即使已安装,也会flask引发与模块缺失相关的错误!rauth

这里的命令:

git clone https://github.com/miguelgrinberg/flask-oauth-example.git
python3.9 -m venv venv
source venv/bin/activate
(venv) pip install -r requirements.txt    ### out: Successfully installed Flask-0.10.1 Flask-Login-0.3.1 Flask-SQLAlchemy-2.0 Jinja2-2.7.3 MarkupSafe-0.23 SQLAlchemy-0.9.8 Werkzeug-0.9.6 argparse-1.2.1 itsdangerous-0.24 rauth-0.7.0 requests-2.4.3

(venv) flask run

它返回:

Error: While importing "app", an ImportError was raised:

Traceback (most recent call last):
  File "/home/enrico/.local/lib/python2.7/site-packages/flask/cli.py", line 235, in locate_app
    __import__(module_name)
  File "/home/enrico/columbia/app/diagnosticator-server-00/app.py", line 5, in <module>
    from oauth import OAuthSignIn
  File "/home/enrico/columbia/app/diagnosticator-server-00/oauth.py", line 3, in <module>
    from rauth import OAuth1Service, OAuth2Service
ImportError: No module named rauth

但如果我检查venv

source venv/bin/activate
(venv) python
from rauth import OAuth1Service, OAuth2Service

它没有问题!

如果我从外部运行 app.py 也是一样的flask

(venv) python app.py
 * Running on http://127.0.0.1:5000/
 * Restarting with reloader

并且没有问题!

任何想法?!

4

0 回答 0