ModulenotFoundError:No模块名为' WebService'
即使在使用模块安装后,
pip3 install webservice
我仍然会得到错误modulenotfounderror:no模块名为“ WebService'”,
我确实使用了虚拟env。 使用pip3安装安装了所有必要的软件包
python3 server.py
。 导入WebService.utils作为web_utils ModulenotFoundError:没有名为“ WebService.utils”的模块; “ WebService”不是包装
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此错误:
modulenotFoundError:无模块名为'WebService.utils';如果您将创建为
webservice.py
的主要程序文件命名为python python webservice.py 或另一个文件在您运行程序的同一文件夹中具有名称
WebService.py
。 Python会将您的程序文件视为模块,并尝试在其中找到一些不在其中的东西。关于Python在哪里寻找模块,请参见sys.s.path
。
在这种情况下,重命名您的程序文件,以使其名称与导入模块的名称不等。
This error:
ModuleNotFoundError: No module named 'webservice.utils'; 'webservice' is not a package
may also occur if you have named the main program file you created aswebservice.py
and try to run it aspython webservice.py
or another file has the namewebservice.py
in the same folder from which you run your program. Python will consider your program file as a module and try to find something in it that is naturally not in it. About where Python is looking for modules, seesys.path
.In this case, rename your program file so that its name does not equal with the name of the imported module.