使用Sublime Text 3作为3.3.2的Python IDE ?

时间:2021-11-05 02:41:11

I recently downloaded Sublime Text 3 (only the demo), and I have found out that you can adjust it so that it highlights Python syntax. I can do all this, yes, but I cannot run it like an IDE. I tried with the normal Python Build System - it gives an error. To be exact, the error is:

我最近下载了Sublime Text 3(只有demo),我发现您可以对其进行调整,使其突出显示Python语法。我可以做所有这些,是的,但是我不能像IDE那样运行它。我尝试使用普通的Python构建系统——它会产生错误。准确地说,错误是:

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

So, I wrote my own. It is called Python3.sublime-build. Here is the code for it:

我自己写的。它被称为Python3.sublime-build。这是它的代码:

{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}

Again, this doesn't work. I tried adding a path to it, but to no avail. All it does is throw this error:

同样,这是行不通的。我试着给它添加一条路径,但没有用。它所做的就是抛出这个错误:

[Errno 2] No such file or directory: 'python3'
[cmd: ['python3', '-u', '']]
[dir: /Applications/Sublime Text.app/Contents/MacOS]
[path: Library/Framework/Python.framework/Versions/3.3/bin/]
[Finished]

I checked and double-checked the path in which it checks, and the file is there. It isn't missing an extension or anything - I checked that, too. I tried manually running the file; that works, too.

我检查并再次检查它检查的路径,文件就在那里。它没有丢失一个分机或任何东西——我也检查过了。我尝试手动运行文件;那工作。

I would really like to get this working, as I am getting tired of IDLE and it's lack of features. Thank you in advance.

我真的很想让这个功能发挥作用,因为我厌倦了空闲,它缺少特性。提前谢谢你。

2 个解决方案

#1


0  

Set your "cmd" to the following:

将你的“cmd”设置为:

"cmd": ["/Library/Framework/Python.framework/Versions/3.3/bin/python3", "-u", "$file"],

and it should work. Probably the reason your path addition didn't work was because it was missing the beginning /.

它应该工作。可能您的路径添加没有成功的原因是它错过了开始/。

#2


0  

The word 'Framework' should be 'Frameworks'. And then it works on my mac.

“框架”这个词应该是“框架”。然后它在我的mac上工作。

#1


0  

Set your "cmd" to the following:

将你的“cmd”设置为:

"cmd": ["/Library/Framework/Python.framework/Versions/3.3/bin/python3", "-u", "$file"],

and it should work. Probably the reason your path addition didn't work was because it was missing the beginning /.

它应该工作。可能您的路径添加没有成功的原因是它错过了开始/。

#2


0  

The word 'Framework' should be 'Frameworks'. And then it works on my mac.

“框架”这个词应该是“框架”。然后它在我的mac上工作。