gpt4 book ai didi

python - "from sqlalchemy import event"不工作

转载 作者:太空宇宙 更新时间:2023-11-03 15:09:17 26 4
gpt4 key购买 nike

我收到一个错误:

MacBook-Pro:microblog_3 olehdubno$ python db_create.py 
Traceback (most recent call last):
File "db_create.py", line 5, in <module>
from app import db
File "/Users/olehdubno/Desktop/microblog_3/app/__init__.py", line 2, in <module>
from flask.ext.sqlalchemy import SQLAlchemy
File "/usr/local/lib/python2.7/site-packages/flask/exthook.py", line 81, in load_module
reraise(exc_type, exc_value, tb.tb_next)
File "/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py", line 24, in <module>
from sqlalchemy import orm, event
ImportError: cannot import name event

我正在研究第四部分:数据库:http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iv-database .

我的github代码:https://github.com/odubno/microblog .

无论我做什么,我都无法导入事件。简单地尝试 from sqlalchemy import event 也不起作用。

Flask==0.10.1
Flask-Restless==0.17.0
Flask-SQLAlchemy==2.0
Flask-WTF==0.11
GraphLab-Create==1.1
Jinja2==2.7.3
MarkupSafe==0.23
Pillow==2.7.0
SQLAlchemy==0.6.8
Tempita==0.5.2
WTForms==2.0.2
Werkzeug==0.10.1
argparse==1.2.1
backports.ssl-match-hostname==3.4.0.2
blaze==0.6.0
boto==2.33.0
daemonize==2.3.1
decorator==3.4.0
folium==0.1.2
geopy==1.4.0
george==0.2.1
ggplot==0.6.5
itsdangerous==0.24
librato-metrics==0.4.9
mimerender==0.5.5
mixpanel-py==3.1.1
nltk==3.0.0
nose==1.3.4
numpy==1.8.2
oauthlib==0.7.2
pandas==0.14.1
patsy==0.3.0
prettytable==0.7.2
psycopg2==2.5.4
pyparsing==2.0.3
pyshp==1.2.1
python-dateutil==2.4.1
python-mimeparse==0.1.4
pytz==2014.7
requests==2.3.0
requests-oauthlib==0.4.2
scikit-learn==0.15.1
six==1.9.0
sqlalchemy-migrate==0.7.2
suds==0.4
sympy==0.7.5
textblob==0.9.0
tornado==3.2.1
twitter==1.15.0
vboxapi==1.0
virtualenv==1.11.6
wsgiref==0.1.2
xlrd==0.9.3
xlwt==0.7.5

最佳答案

Events were added到 0.7 版的 SQLAlchemy。您使用的是 0.6.8 版。升级将修复您的 ImportError

pip install -U sqlalchemy

0.7 版是几年前发布的。 0.9.9 是最新的(在回答这个问题时)。除非您对 0.6 有特定需求,否则升级应该是值得的。

关于python - "from sqlalchemy import event"不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28998776/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com