[英]Import Error: No module named 'utils' when running a script with the lpthw.web framework
I am new to python and I am following "Learn Python the Hard Way" by Zed Shaw. 我是python的新手,我在关注Zed Shaw的“学习Python的艰难方法”。 In chapter 50, he asks you to download the lpthw.web framework and run the following the program I listed on the bottom. 在第50章中,他要求您下载lpthw.web框架并运行下面列出的以下程序。 However, when I try to do so, I get the following error. 但是,当我尝试这样做时,出现以下错误。 The book recommended using Python 2 but I decided to try Python 3. I am on a windows 7 computer. 该书推荐使用Python 2,但我决定尝试使用Python3。我在Windows 7计算机上。 If the problem is that I am using Python 3, is there a way to make that framework Python 3 friendly or which other one is recommended for someone learning. 如果问题是我使用的是Python 3,那么有没有一种方法可以使该框架与Python 3友好,或者建议其他人学习该框架。 Thank you very much for the help. 非常感谢你的帮助。
Error: 错误:
Traceback (most recent call last):
File "app.py", line 1, in <module>
import web
File "C:\Python33\lib\site-packages\web\__init__.py", line 14, in <module>
import utils, db, net, wsgi, http, webapi, httpserver, debugerror
ImportError: No module named 'utils'
Program: 程序:
import web
urls = (
'/', 'index'
)
app = web.application(urls, globals())
class index:
def GET(self):
greeting = "Hello World"
return greeting
if __name__ == "__main__":
app.run()
pip install utils
将解决您的问题:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.