Sublime Text 2 build gives a different result from iPython on the command line

2

I'm trying to migrate to Sublime Text 2 and do everything without leaving the program. Before I ran a script with the following line:

from scipy.stats import beta, bernoulli, gaussian_kde

No shell within iPithon the command runs normally.

If I give build ( cmd + b or Tools -> Build) within Sublime Text 2 it does not find scipy.stats :

  

ImportError: No module named scipy.stats

How to solve this?

    
asked by anonymous 08.03.2014 / 17:55

1 answer

3

Probably Sublime Text is using another Python installation (which does not have the Scipy library installed).

To use the correct version of Python, you need to modify a setting in the file Python.sublime-build , which is in Preferences > Browse Packages » Python . The correct configuration depends on your system, your settings, and your personal preferences:

Option 1: Change the Python installation path

Set the path of your Python installation manually within the "cmd" option:

"cmd": ["C:/caminho/do/python/python.exe", "-u", "$file"],

Option 2: Specify the PATH

Copy the contents of your PATH variable to the "path" option:

"path": "C:\caminho\do\python;C:\caminho\de\outra\coisa",

Option 3: Specify the PYTHONPATH

Specify the path of the desired PYTHONPATH in an "env" dictionary entry:

"env": {
    "PYTHONPATH":"C:/caminho/do/python;C:/caminho/do/python/2.7.2/lib/python2.7/site-packages"
},
    
09.03.2014 / 13:41