cherrypy演示中缺少tutorial.conf文件

4 投票
3 回答
1213 浏览
提问于 2025-04-18 17:07

我按照这里的说明安装了CherryPy:

http://docs.cherrypy.org/en/latest/install.html

当我运行:

python -m cherrypy.tutorial.tut01_helloworld

时,出现了以下错误:

Traceback (most recent call last):
 File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
  "__main__", fname, loader, pkg_name)
 File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
   exec code in run_globals
 File "/usr/local/lib/python2.7/dist-packages/cherrypy/tutorial/tut01_helloworld.py",       line 34, in <module>
  cherrypy.quickstart(HelloWorld(), config=tutconf)
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/__init__.py", line 169, in   quickstart
   _global_conf_alias.update(config)
   File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cpconfig.py", line 158, in update
   reprconf.Config.update(self, config)
   File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/reprconf.py", line 160, in update
   config = Parser().dict_from_file(config)
   File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/reprconf.py", line 232, in dict_from_file
   self.read(file)
    File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/reprconf.py", line 202, in read
    fp = open(filename)
   IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/cherrypy/tutorial/tutorial.conf'

这是CherryPy缺少什么东西,还是我应该做些什么?

谢谢

3 个回答

0

如果你安装的是Python 2.7版本,那么你可以在这个文件夹里找到一个叫做 tutorial.conf 的文件。

C:\Python27\cherrypy\tutorial
4

我在OS X 10.10 Yosemite上也遇到了同样的问题。我从github上下载了文件,然后把它复制到了这个路径:/Library/Python/2.7/site-packages/cherrypy/tutorial。

https://github.com/cherrypy/cherrypy/blob/master/cherrypy/tutorial/tutorial.conf
7

我也遇到过同样的问题。在这里找到了缺失的文件:

Python34\Lib\site-packages\PURELIB\cherrypy\tutorial

撰写回答