通过Pathogen安装VIM-Latex时出现StringIO和字符串导入错误

0 投票
1 回答
1870 浏览
提问于 2025-04-18 09:43

我在我的电脑上安装VIM-Latex插件,使用的是Pathogen这个工具,电脑系统是OSX Lion 10.7.5。我把下载好的VIM-Latex插件文件放到了我的~/.vim/bundle目录里。

我还按照这里的说明修改了.vimrc文件。

但是,当我尝试在MAC的Vim中打开一个tex文档时,出现了以下错误:

 File "/Users/username/.vim/bundle/vim-latex-1.8.23-20130116.788-git2ef9956/ftplugin/latex-  suite/outline.py", line 12, in <module>
import StringIO
ImportError: No module named StringIO   
Error detected while processing /Users/username/.vim/bundle/vim-latex-1.8.23-20130116.788-git2ef9956/ftplugin/latex-suite/main.vim:

还有

File "/Users/username/.vim/bundle/vim-latex-1.8.23-20130116.788-git2ef9956/ftplugin/latex-suite/pytools.py", line 1, in <module>
import string, vim, re, os, glob
ImportError: No module named string

另外,我在终端运行了一个简单的python脚本,里面导入了StringIO和string,这两个模块都能正常导入。

我不太确定问题出在哪里。因为我对VIM和安装插件都很陌生,所以不知道该如何调试这个问题,任何帮助对我来说都非常重要!

谢谢!

1 个回答

1

StringIOstring 在 Python 3.x 中是不可用的。要让这段代码正常运行,你需要使用 Python 2.x,比如 Python 2.7。

撰写回答