开发者

NameError: name '__builtin__' is not defined while installing SQLAlchemy

开发者 https://www.devze.com 2023-03-16 01:55 出处:网络
I\'ve installed Python 2.7.2 on my Windows XP computer. I recently installed SQLAlchemy 0.7.1 using \'python setup.py install\'. During the installation, I got the following error messages:

I've installed Python 2.7.2 on my Windows XP computer.

I recently installed SQLAlchemy 0.7.1 using 'python setup.py install'. During the installation, I got the following error messages:

byte-compiling C:\Python27\Lib\site-packages\sqlalchemy\sql\visitors.py to visitors.pyc
SyntaxError: ('invalid syntax', ('C:\\Python27\\Lib\\site-packages\\sqlalchemy\\sql\\visitors.py', 66, 34, 'class Visitable(object, metaclass=VisitableType):\n'))

When I try to import sqlalchemy, I get the following stack trace:

>>> import sqlalchemy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\sqlalchemy\__init__.py", line 12, in <module>
  from sqlalchemy.sql import (
File "C:\Python27\lib\site-packages\sqlalchemy\sql\__init__.py", line 7, in <module>
from sqlalchemy.sql.expression import (
File "C:\Python27\lib\site-packages\sqlalchemy\sql\expression.py", line 32, in <module>
from sqlalchemy import util, exc
File "C:\Python27\lib\site-packages\sqlalchemy\util\__init__.py", line 7, in <module>
from .compat import callable, cmp, reduce, defaultdict, py25_dict, \
File "C:\Python27\lib\site-packages\sqlalchemy\util\compat.py", line 93, in <module>
callable = __builtin__.callable
NameError: name '__builtin__' is not defined

Other scripts work fine and all the functions in __builtin__ seem to be available.

I can't find any examples of similar problems on Google or in the SQLAlchemy documentation.

What's wrong?

UPDATE:

Uncommenting import __builtin__ in compat.py removed the first problem. Now I seem to have problems with visitors.py:

>>> import sqlalchemy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\sqlalchemy\__init__.py", line 12, in <module>
from sqlalchemy.sql import (
File "C:\Python27\lib\site-packages\sqlalchemy\sql\__init__.py", line 7, in <module>
from sqlalchemy.sql.expression import (
File "C:\Python27\lib\site-packages\sqlalchemy\sql\expression.py", line 35, in <module>
from sqlalchemy.sql.visitors import Visitable, cloned_traverse
File "C:\Python27\lib\site-packages\sqlalchemy\sql\visitors.py", line 66
class Visitable(object, metaclass=VisitableType):
                                 ^
SyntaxError: invalid syntax
开发者_StackOverflow中文版


Problem partially solved: everything started working when I rolled back to SQLAlchemy 0.6.8. An issue with 0.7.1 + Windows/2.6?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号