使用Ubuntu 14.04
如何告诉Sublime text 3和SublimeREPL在哪里查找python包?
从我的终端,pip list
返回一个包含许多python包的列表:
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)
但是,在Sublime文本3中,在控制台上:
>>> 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'
来自SulbimeREPL控制台:
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'
所以,我认为需要设置一些东西。
答案 0 :(得分:0)
您需要将SublimeRepl指向正确的解释器。
添加到Settings -> Package Settings -> SublimeREPL -> Settings - User
{
"default_extend_env": {"PATH": "{PATH}:/usr/lib/python2.7"}
}