问题
Working with Ubuntu 14.04
How to tell Sublime text 3 and SublimeREPL where to look for the python packages?
From my terminal, pip list
returns a list with many python packages like that:
numexpr (2.2.2)
numpy (1.8.2)
oauthlib (0.6.1)
oneconf (0.3.7)
openpyxl (2.2.5)
PAM (0.4.2)
pandas (0.16.2)
However, inside Sublime text 3, on the console:
>>> import openpyxl
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'openpyxl'
>>> import pandas
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'pandas'
>>> import numpy
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'numpy'
From the SulbimeREPL console:
Python 3.3.6 (default, Jan 28 2015, 17:27:09)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pandas'
>>> import openpyxl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'openpyxl'
So, I assume that something needs to be set up.
回答1:
You need to point SublimeRepl to the right interpreter.
Add to Settings -> Package Settings -> SublimeREPL -> Settings - User
{
"default_extend_env": {"PATH": "{PATH}:/usr/lib/python2.7"}
}
来源:https://stackoverflow.com/questions/31400372/manage-python-packages-in-sublime-text-3