Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
147 views
in Technique[技术] by (71.8m points)

python - ImportError: No module named sqlalchemy

I'm unable to find a module in python ,though easy_install says its already installed. Any idea how to resolve this isseue?

$ python -c "from flaskext.sqlalchemy import SQLAlchemy"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named sqlalchemy


$ python -V
Python 2.7


$ sudo easy_install sqlalchemy
Searching for sqlalchemy
Best match: SQLAlchemy 0.7.7
Adding SQLAlchemy 0.7.7 to easy-install.pth file

Using /usr/lib/python2.7/site-packages
Processing dependencies for sqlalchemy
Finished processing dependencies for sqlalchemy

$ sudo pip install SQLAlchemy --upgrade Requirement already up-to-date: SQLAlchemy in /usr/lib/python2.7/site-packages Cleaning up...

Though pip says it's installed.But I can't find them in sys.path output.

$ sudo python -c "import sys;print sys.path" ['',
'/usr/lib/python2.7/site-packages/Flask_SQLAlchemy-0.15-py2.7.egg',
'/usr/lib/python2.7/site-packages/Flask-0.8-py2.7.egg',
'/usr/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg',
'/usr/lib/python2.7/site-packages/Werkzeug-0.8.3-py2.7.egg',
'/usr/lib/python2.7/site-packages/Flask_WTF-0.5.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/WTForms-0.6.3-py2.7.egg',
'/usr/lib/python2.7/site-packages/Flask_Mail-0.6.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/blinker-1.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/lamson-1.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/python_daemon-1.6-py2.7.egg',
'/usr/lib/python2.7/site-packages/nose-1.1.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/mock-0.8.0-py2.7.egg',
'/usr/lib/python2.7/site-packages/chardet-1.0.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/lockfile-0.9.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/Flask_FlatPages-0.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/Markdown-2.1.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-i686.egg',
'/usr/lib/python2.7/site-packages/uWSGI-1.0.3-py2.7.egg',
'/usr/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-i686.egg',
'/usr/lib/python27.zip', '/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',
'/usr/lib/python2.7/site-packages',
'/usr/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Did you install flask-sqlalchemy? It looks like you have SQLAlchemy installed but not the Flask extension. Try pip install Flask-SQLAlchemy in your project's virtualenv to install it from PyPI.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...