当我运行“import pylons”时,为什么无法识别 Pylons?在 Windows Vista 命令提示符中?
当我尝试在虚拟 python 环境中导入 pylons 时,出现错误
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
据我了解,Python 告诉我它找不到名为 registry 的模块。也许这是我在安装 Pylons 时遇到的错误的结果,这里有解释 为什么在 Windows Vista 64 中使用 easy_install 和 Python 2.7 安装 Pylons 1.0 的最后一行会出现错误?
似乎安装了许多 Pylon 组件,但我猜 registry 没有安装,或者 Pylons 可能看不到它。
关于如何解决这个问题有什么想法吗?
When I try to import pylons in the virtual python environment I get the error
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
As I understand this error, Python is telling me that it can not find the module named registry. Perhaps this is a result of the error I got while installing Pylons which is explained over here Why do I get an error on the last line of installing Pylons 1.0 with easy_install and Python 2.7 in Windows Vista 64?
It seems that many of the Pylon components were installed but I guess registry was not or maybe Pylons just can not see it.
Any ideas on how to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须先激活虚拟环境,然后才能导入塔。
与此相比,
我猜测您已在虚拟环境外部和内部安装了 pylons 软件包。因此,python 允许您导入 pylons,但粘贴包未安装在虚拟环境之外,因此您会收到错误。
运行 activate 批处理脚本(应位于 env\Scripts 文件夹内)应该可以解决问题。
You have to activate the virtual environment before you can import pylons.
vs. this
I guessing that you have the pylons package installed outside and inside your virtual environment. So python is letting you import pylons but the paste package is not installed outside of your virtual environment so you are getting an error.
Running the activate batch script (should be inside your env\Scripts folder) should solve the problem.