Python 运行示例金字塔程序时出现问题。给定ImportError:没有名为execptions的模块错误

Python 运行示例金字塔程序时出现问题。给定ImportError:没有名为execptions的模块错误,python,pyramid,Python,Pyramid,我不熟悉python和Pyramid。 我今天已经安装了pyramid,并且已经在我的mac机器上预装了python 2.7.1。我已经安装了金字塔。我在网站中提到的nositepackages中使用了virtualenv,并在我的/users/sreekanth目录中安装了pyramid 安装后,我尝试了前面提到的第一个示例程序 当我尝试运行程序时,我得到一个错误,如下所示 sreekanths-MacBook-Pro:tasks Sreekanth$ ../bin/python2.7 tas

我不熟悉python和Pyramid。 我今天已经安装了pyramid,并且已经在我的mac机器上预装了python 2.7.1。我已经安装了金字塔。我在网站中提到的nositepackages中使用了virtualenv,并在我的
/users/sreekanth
目录中安装了pyramid

安装后,我尝试了前面提到的第一个示例程序

当我尝试运行程序时,我得到一个错误,如下所示

sreekanths-MacBook-Pro:tasks Sreekanth$ ../bin/python2.7 tasks.py
Traceback (most recent call last):
  File "tasks.py", line 87, in <module>
    config.scan()
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/config/__init__.py", line 893, in scan
    scanner.scan(package, categories=categories, onerror=onerror)
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/venusian-1.0a2-py2.7.egg/venusian/__init__.py", line 95, in scan
    invoke(name, ob)
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/venusian-1.0a2-py2.7.egg/venusian/__init__.py", line 92, in invoke
    callback(self, name, ob)
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/view.py", line 210, in callback
    config.add_view(view=ob, **settings)
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/config/views.py", line 575, in wrapper
    return wrapped(*arg, **defaults)
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/config/util.py", line 59, in wrapper
    result = wrapped(self, *arg, **kw)
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/config/views.py", line 926, in add_view
    context = self.maybe_dotted(context)
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/config/__init__.py", line 808, in maybe_dotted
    return self.name_resolver.maybe_resolve(dotted)
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/path.py", line 318, in maybe_resolve
    return self._resolve(dotted, package)
  File "/Users/Sreekanth/env/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/path.py", line 325, in _resolve
    return self._zope_dottedname_style(dotted, package)


  File "/Users/Sreekanth/env/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/path.py", line 374, in _zope_dottedname_style
    __import__(used)
ImportError: No module named execptions
sreekanths MacBook Pro:tasks Sreekanth$../bin/python2.7 tasks.py
回溯(最近一次呼叫最后一次):
文件“tasks.py”,第87行,在
config.scan()
文件“/Users/Sreekanth/env/lib/python2.7/site packages/pyramid-1.3a3-py2.7.egg/pyramid/config/_init___;.py”,第893行,扫描
scanner.scan(包,类别=类别,onerror=onerror)
文件“/Users/Sreekanth/env/lib/python2.7/site packages/venusian-1.0a2-py2.7.egg/venusian/_init___;.py”,第95行,扫描
调用(名称,ob)
文件“/Users/Sreekanth/env/lib/python2.7/site packages/venusian-1.0a2-py2.7.egg/venusian/_init__.py”,第92行,在调用中
回调(self、name、ob)
回调中的文件“/Users/Sreekanth/env/lib/python2.7/site packages/pyramid-1.3a3-py2.7.egg/pyramid/view.py”,第210行
配置添加视图(视图=ob,**设置)
包装器中的文件“/Users/Sreekanth/env/lib/python2.7/site packages/pyramid-1.3a3-py2.7.egg/pyramid/config/views.py”,第575行
返回已包装(*参数,**默认值)
文件“/Users/Sreekanth/env/lib/python2.7/site packages/pyramid-1.3a3-py2.7.egg/pyramid/config/util.py”,第59行,在包装器中
结果=包裹(自身,*arg,**kw)
文件“/Users/Sreekanth/env/lib/python2.7/site packages/pyramid-1.3a3-py2.7.egg/pyramid/config/views.py”,第926行,添加视图
上下文=自我。可能是虚线(上下文)
文件“/Users/Sreekanth/env/lib/python2.7/site packages/pyramid-1.3a3-py2.7.egg/pyramid/config/_init__.py”,第808行,以虚线表示
返回self.name\u resolver.maybe\u resolve(虚线)
文件“/Users/Sreekanth/env/lib/python2.7/site packages/pyramid-1.3a3-py2.7.egg/pyramid/path.py”,第318行,以可能的格式
返回自我解决(虚线,包装)
文件“/Users/Sreekanth/env/lib/python2.7/site packages/pyramid-1.3a3-py2.7.egg/pyramid/path.py”,第325行,in_
返回自我。_zope_dottedname_样式(虚线,包装)
文件“/Users/Sreekanth/env/lib/python2.7/site packages/pyramid-1.3a3-py2.7.egg/pyramid/path.py”,第374行,采用“zope”和“dottedname”样式
__导入(已使用)
ImportError:没有名为execptions的模块
而且我也不能从python外壳导入金字塔模块。下面是我收到的错误消息

sreekanths-MacBook-Pro:bin Sreekanth$ pwd
/Users/Sreekanth/env/bin
sreekanths-MacBook-Pro:bin Sreekanth$ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyramid
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pyramid
sreekanths MacBook Pro:bin Sreekanth$pwd
/用户/Sreekanth/env/bin
sreekanths MacBook Pro:bin Sreekanth$python
Python 2.7.1(r271:8683210116月16日,16:59:05)
[GCC 4.2.1(基于苹果公司5658版本)(LLVM版本2335.15.00)]关于达尔文
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>进口金字塔
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:没有名为pyramid的模块

有没有人能解释一下我遗漏了什么,以及我是如何做到这一点的。

第一个错误表明你的程序有输入错误。很可能是你写的

from pyramid.execptions import NotFound
而不是

from pyramid.exceptions import NotFound
#              ^^
由于您已将Pyland/pyramid安装到virtualenv中,因此需要首先使用命令行中的
source bin/activate
激活它。这将设置正确的python路径,您可以通过在python控制台中检查
sys.path
来检查该路径