1
OS X 10.5의 virtualenv에서 SQLAlchemy를 사용하려고하지만로드 할 수없는 것으로 보입니다. 여기 SQLAlchemy 및 VirtualEnv 관련 문제
내가 내가 인터프리터에서 SQLAlchemy의를 가져 오려고mkvirtualenv --no-site-packages test
easy_install sqlalchemy
을했던 모든 것이 잘 작동거야,하지만 난 파이썬 스크립트에서 SQLAlchemy의를 가져 오려고한다면, 나는 다음과 같은 오류가 발생합니다 :
여기 IBM
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
Base = declarative_base()
class Filesystem(Base):
__tablename__ = 'filesystem'
path = Column(String, primary_key=True)
name = Column(String)
def __init__(self, path,name):
self.path = path
self.name = name
def __repr__(self):
return "<Metadata('%s','%s')>" % (self.path,self.name)
내가 '파이썬 test.py'를 실행 해보십시오
에서 튜토리얼 스크립트 그리고이 결과 :
$ python test.py
Traceback (most recent call last):
File "test.py", line 4, in <module>
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
File "/Users/grant/Development/Aircraft/sqlalchemy.py", line 3, in <module>
from sqlalchemy.ext.declarative import declarative_base
ImportError: No module named ext.declarative
은 여기 내 sys.path에
>>> import sys
>>> print '\n'.join(sys.path)
/Users/grant/Development/Python/test/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg
/Users/grant/Development/Python/test/lib/python2.6/site-packages/SQLAlchemy-0.5.4p2-py2.6.egg
/Users/grant/Development/Python/test/lib/python26.zip
/Users/grant/Development/Python/test/lib/python2.6
/Users/grant/Development/Python/test/lib/python2.6/plat-darwin
/Users/grant/Development/Python/test/lib/python2.6/plat-mac
/Users/grant/Development/Python/test/lib/python2.6/plat-mac/lib-scriptpackages
/Users/grant/Development/Python/test/lib/python2.6/lib-tk
/Users/grant/Development/Python/test/lib/python2.6/lib-old
/Users/grant/Development/Python/test/lib/python2.6/lib-dynload
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages
/Users/grant/Development/Python/test/lib/python2.6/site-packages
무슨 일이 일어나고 있는지에 어떤 아이디어에있어 무엇?
LOL, 나는 다른 라이브러리에서 같은 종류의 문제가있었습니다. –