我正在学习Elixir和SQLAlchemy。我已经创建了一个连接到MySQL数据库的Python文件,但是当我使用Python执行时,我立即收到以下错误:
root@raspberrypi:/Python/mainFlask/yonkiPOPS# python yonki.py
Traceback (most recent call last):
File "yonki.py", line 1, in <module>
from elixir import metadata, Entity, Field
File "/usr/local/lib/python2.7/dist-packages/Elixir-0.7.1-py2.7.egg/elixir/__init__.py", line 29, in <module>
from elixir.entity import Entity, EntityBase, EntityMeta, EntityDescriptor, \
File "/usr/local/lib/python2.7/dist-packages/Elixir-0.7.1-py2.7.egg/elixir/entity.py", line 17, in <module>
from sqlalchemy.orm import MapperExtension, mapper, object_session, \
ImportError: cannot import name ScopedSession
我一直在寻找它,但是我找不到原因。这是yonki.py文件:
from elixir import metadata, Entity, Field
from elixir import Unicode, UnicodeText
from elixir import *
class User(Entity):
username = Field(String(64))
metadata.bind = 'mysql://root:nomasandroid42@localhost/yonkiPOPS'
session.bind.echo = True
setup_all()
create_all()
我认为可能是由于某个必需的模块未安装,但我不知道是哪个。