How to configure Sublime text 2 to use my installed python libraries

僤鯓⒐⒋嵵緔 提交于 2020-01-25 07:50:06

问题


I just started using Sublime Text 2 and I can't seem to get it to work with most of the libraries I have installed for Python 2.7 for windows, every time I try to import them and run it, it gives me this message "C:\Python27\Python.exe: can't find 'main' module in ''".

I tried configuring the Python.sublime-build but nothing I do to it seems to work, for reference this is what it has right now:

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

I'm learning to program and I've only used IDLE so far so I'm very new to Sublime, I'm most likely missing something, if you guys can help I would really appreciate it.


回答1:


Seems to be a year late but for this kind of problem, I think you just test by running on a "untitled" file (which means you didn't save it under .py file). You have to save it then run it.

The point is sublime text will call the cmd, call python in command line and pass the python script file name to it. If you don't save the file, it's like calling python.exe to run on nothing.



来源:https://stackoverflow.com/questions/16945908/how-to-configure-sublime-text-2-to-use-my-installed-python-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!