1

有谁知道是否有在 ST3 中安装插件SublimeClang的特殊方法?在 sublime text 2 中,我们用于 python 链接的 sublime text 文件夹内曾经有一个“lib”文件夹。就我而言,我安装了 python2.6 并创建了一个链接,并将其放入新创建的“lib”文件夹 ( /opt/sublime_text/lib),但它不起作用。知道它如何与 ST3 一起工作吗?

非常感谢您提前。

PS:这是我启动 ST3 时的输出。

reloading plugin SublimeClang.common
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 73, in reload_plugin
m = importlib.import_module(modulename)
File "X/importlib/__init__.py", line 88, in import_module
File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1023, in load_module
File "<frozen importlib._bootstrap>", line 1004, in load_module
File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 854, in _load_module
File "<frozen importlib._bootstrap>", line 981, in get_code
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/jean/.config/sublime-text-3/Packages/SublimeClang/common.py", line 135
  print msg
          ^
SyntaxError: invalid syntax
reloading plugin SublimeClang.errormarkers
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 73, in reload_plugin
  m = importlib.import_module(modulename)
File "X/importlib/__init__.py", line 88, in import_module
File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1023, in load_module
File "<frozen importlib._bootstrap>", line 1004, in load_module
File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 869, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/jean/.config/sublime-text-3/Packages/SublimeClang/errormarkers.py", line 4, in <module>
    from common import get_setting
ImportError: No module named 'common'
reloading plugin SublimeClang.staticanalyzer
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 73, in reload_plugin
  m = importlib.import_module(modulename)
File "X/importlib/__init__.py", line 88, in import_module
File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1023, in load_module
File "<frozen importlib._bootstrap>", line 1004, in load_module
File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 869, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/jean/.config/sublime-text-3/Packages/SublimeClang/staticanalyzer.py", line 31, in <module>
  import Queue
ImportError: No module named 'Queue'
reloading plugin SublimeClang.sublimeclang
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 73, in reload_plugin
  m = importlib.import_module(modulename)
File "X/importlib/__init__.py", line 88, in import_module
File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1023, in load_module
File "<frozen importlib._bootstrap>", line 1004, in load_module
File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 854, in _load_module
File "<frozen importlib._bootstrap>", line 981, in get_code
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/jean/.config/sublime-text-3/Packages/SublimeClang/sublimeclang.py", line 415
  print "found fast completions"
                               ^
SyntaxError: invalid syntax
reloading plugin SublimeClang.translationunitcache
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 73, in reload_plugin
  m = importlib.import_module(modulename)
File "X/importlib/__init__.py", line 88, in import_module
File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1023, in load_module
File "<frozen importlib._bootstrap>", line 1004, in load_module
File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 854, in _load_module
File "<frozen importlib._bootstrap>", line 981, in get_code
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/jean/.config/sublime-text-3/Packages/SublimeClang/translationunitcache.py", line 103
    print "Have SublimeClang package: %s" % json
                                    ^
SyntaxError: invalid syntax
4

2 回答 2

1

从您的链接来看,该插件似乎不再被积极开发,自述文件中也没有提到 ST3。错误消息暗示 a) 模块正在尝试加载其他不存在或已移动的模块,并且 b) 插件是用 Python 2 编写的(ST2 使用 Python 2.6),而 ST3​​ 基于 Python 3.3。作为一个非常简短的示例,print "Hello World!"Python 2 中的语句已替换为print("Hello World!")Py3 中的函数。至于缺少的模块错误,ST3 在底层的组织方式与 ST2 不同,除了最简单的插件外,几乎所有插件都需要移植到新的 API。

于 2013-07-03T17:29:00.790 回答
1

我通过更改 python 文件中的导入解决了这个问题。

于 2013-07-05T09:25:27.840 回答