9Algorithm
9Algorithm

Reputation: 1257

Python settings in Sublime Text 2

When I press ctrl+B in SB2 in the console I get ImportError: No module named site. How to fix it?

Upvotes: 0

Views: 111

Answers (1)

elyase
elyase

Reputation: 40973

First make sure that you saved the file with .py extension and then try to run again. You also need to check that the Python in your .sublime-build is correct. For this look at %APPDATA%\Sublime Text 2\Python\Python.sublime-build file. This file should have something like this:

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

This is equivalent to doing the following on the command line, check that you can do:

python -u C:\your_path\your_script.py

If this doesn't work from the command line it also wont from sublime.

Upvotes: 1

Related Questions