繁体   English   中英

在Sublime文本3中管理python软件包

[英]Manage python packages in Sublime text 3

使用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'

因此,我认为需要进行一些设置。

您需要将SublimeRepl指向正确的解释器。

添加到Settings -> Package Settings -> SublimeREPL -> Settings - User

{
    "default_extend_env": {"PATH": "{PATH}:/usr/lib/python2.7"}
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM