Python 为什么当我运行';导入塔架';在Windows Vista命令提示符中?

Python 为什么当我运行';导入塔架';在Windows Vista命令提示符中?,python,windows,installation,pylons,Python,Windows,Installation,Pylons,当我尝试在虚拟python环境中导入挂架时,会出现错误 C:\env\Scripts>python Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (A MD64)] on win32 Type "help", "copyright", "credits" or "license" for more informati on. >>> import pylons Traceback (mos

当我尝试在虚拟python环境中导入挂架时,会出现错误

C:\env\Scripts>python
Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (A
MD64)] on win32
Type "help", "copyright", "credits" or "license" for more informati
on.
>>> import pylons
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\env\lib\site-packages\pylons-1.0-py2.7.egg\pylons\__init
__.py", line 6, in <module>
    from paste.registry import StackedObjectProxy
ImportError: No module named registry
C:\env\Scripts>python
Python 2.7(r27:825252010年7月4日,07:43:08)[MSC v.1500 64位(A
win32上的[MD64)]
键入“帮助”、“版权”、“信用证”或“许可证”了解更多信息
在…上
>>>进口塔架
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“C:\env\lib\site packages\pylons-1.0-py2.7.egg\pylons\\uu init
__.py“,第6行,在
从paste.registry导入StackedObject代理
ImportError:没有名为registry的模块
据我所知,Python告诉我它找不到名为registry的模块。也许这是我在安装塔架时出错的结果,这里已经解释过了

看起来很多挂架组件都安装了,但我猜注册表没有安装,或者挂架根本看不到


有没有办法解决这个问题?

在导入挂架之前,您必须激活虚拟环境

C:\Users\Josh>env\scripts\activate
(env) C:\Users\Josh>python
ActivePython 2.6.2.2 (ActiveState Software Inc.) based on
Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylons
>>>
与此相比

C:\Users\Josh\env\Scripts>python
ActivePython 2.6.2.2 (ActiveState Software Inc.) based on
Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> pylons
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'pylons' is not defined
>>>
C:\Users\Josh\env\Scripts>python
ActivePython 2.6.2.2(ActiveState软件公司)基于
Python 2.6.2(r262:71600,2009年4月21日,15:05:37)[MSC v.1500 32位(英特尔)]上
win32
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>塔架
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
NameError:未定义名称“挂架”
>>>
我猜您已经在虚拟环境内外安装了pylons包。因此,python允许您导入挂架,但粘贴包没有安装在您的虚拟环境之外,因此您会遇到一个错误


运行激活批处理脚本(应该在env\Scripts文件夹中)可以解决问题。

您确定安装的挂架版本为1吗。与Vista兼容,2。与Python 2.7和3兼容。是否与64位版本的Python 2.7兼容?大多数非标准库或扩展与适用于AMD64的Python不兼容。我确信我安装了Pylons 1.0。就其与Vista和AMD64的兼容性而言,我认为《Pylons》的作者应该在Pylon的网站上提到这一点。该网站上写着“上面的Python2系列,包括2.4(目前不支持Python3或更高版本)”。现在我真的很困惑。你是说我必须安装Python 32位吗?我意识到我需要做的是让Python的distils访问我的编译器工具链,以便构建必要的64位扩展。我仍在试图找出如何做到这一点。在@pyfunc的帮助下,您可以尝试使用32位版本的Python。尽管我有一台64位机器和操作系统,但我还是使用32位版本,因为64位版本会造成不兼容。如果我在Linux发行版上使用64位python,会有这个问题吗?或者这只是与windows相关?谢谢你的提示。