简体   繁体   English

导入错误:使用lpthw.web框架运行脚本时,没有名为“ utils”的模块

[英]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.

相关问题 Python - lpthw.web框架中的异常“没有名为index的模板” - Python - Exception “No template named index” in lpthw.web framework 安装 lpthw.web 后找不到“Web”模块 - 'Web' module cannot be found while having installed lpthw.web 导入错误:没有名为&#39;utils&#39;的模块 - Import Error: No module named 'utils' 点-点安装lpthw.web失败 - pip - pip install lpthw.web fails 导入错误:使用 pickle.load 时没有名为“utils”的模块 - Import error: No module named “utils” when using pickle.load 错误:当为 python 导入模块时,没有名为“_plotly_utils.importers”的模块 - Error: No module named '_plotly_utils.importers' when import a module plotly for python 运行 Python 脚本 CRON 时遇到问题:导入错误:没有名为 Tweepy 的模块 - Trouble running Python script CRON: Import Error: No Module Named Tweepy 运行 pip 列表时出错(modulenotfounderror no module named 'pip._internal.utils') - Error when running pip list (modulenotfounderror no module named 'pip._internal.utils') 来自utils import label_map_util导入错误:没有名为utils的模块 - from utils import label_map_util Import Error: No module named utils 在crontab中运行python脚本时出现“ ImportError:没有名为praw的模块”错误 - “ImportError: No module named praw” error when running python script in crontab
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM