崇高的构建系统错误“在“"中找不到“__main__"模块 [英] sublime build system error "can't find '__main__' module in ''"

查看:41
本文介绍了崇高的构建系统错误“在“"中找不到“__main__"模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让 Sublime3 与 Python3.6.5 一起工作,并在下面收到一条错误消息.

I'm trying to get Sublime3 to work with Python3.6.5 and getting an error message below.

/usr/bin/python: can't find '__main__' module in ''
[Finished in 0.1s with exit code 1]
[shell_cmd: python -u ""]
[dir: /Applications/Sublime Text.app/Contents/MacOS]
[path:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]

推荐答案

此错误表明您在尝试运行构建之前没有保存 Python 脚本文件.请特别注意,在您发布的输出中,您会看到 shell_cmd 被执行为:

This error is indicative of your not having saved your Python script file before you tried to run the build. In particular notice that in your posted output, you see the shell_cmd that was executed as:

[shell_cmd: python -u ""]

也就是说,它试图用空文件名执行 python.例如,将其与 sublime-build 文件的内容进行比较,后者可能看起来像:

That is, it's trying to execute python with an empty file name. For example, compare that to the contents of your sublime-build file, which probably looks something like:

"shell_cmd": "python -u \"$file\"",

如果文件没有保存,文件就没有名字,结果Python解释器报同样的事情:

If the file is not saved, the file has no name, and as a result, the Python interpreter complains about the same thing:

/usr/bin/python: can't find '__main__' module in ''

模块名称是一个空字符串 (''),它应该是您尝试执行的文件的名称.

The module name is an empty string (''), which should be the name of the file that you're trying to execute.

这篇关于崇高的构建系统错误“在“"中找不到“__main__"模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆