Vim错误`未定义的符号:PyUnicodeUCS2_AsWideChar`安装后YouCompleteMe
问题描述:
我试图安装YouCompleteMe为Vim 7.4与包括修补程序1-712在Ubuntu 15.10。Vim错误`未定义的符号:PyUnicodeUCS2_AsWideChar`安装后YouCompleteMe
我已经hand编译YouCompleteMe因为我遇到了一个错误看起来像这样:
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
正如FAQ Section指出,加入-DPYTHON_LIBRARY=/usr/lib/libpython2.7.so
将解决这个问题。因此,与此compliled它来代替:
cmake -G "Unix Makefiles" -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
则:
cmake --build . --target ycm_support_libs --config Release
在编译时这段时间我没有遇到任何错误,但是当我打开Vim的我,我看这个:
import ycm_client_support
ImportError: /home/austin/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so: undefined symbol: PyUnicodeUCS2_AsWideChar
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython:
line 33:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython:
line 33:
File "<string>", line 29, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython:
line 33:
File "/home/austin/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 32, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython:
line 33:
from ycm.omni_completer import OmniCompleter
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython:
line 33:
File "/home/austin/.vim/bundle/YouCompleteMe/autoload/../python/ycm/omni_completer.py", line 22, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython:
line 33:
from ycmd.completers.completer import Completer
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPyth
on:
line 33:
File "/home/austin/.vim/bundle/YouCompleteMe/autoload/../third_party/ycmd/ycmd
/completers/completer.py", line 25, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPyth
on:
line 33:
from ycm_client_support import FilterAndSortCandidates
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPyth
on:
line 33:
ImportError: /home/austin/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_
support.so: undefined symbol: PyUnicodeUCS2_AsWideChar
有谁知道如何解决这个问题?
答
这看起来像在Python FAQ中描述的问题=>https://docs.python.org/2/faq/extending.html#when-importing-module-x-why-do-i-get-undefined-symbol-pyunicodeucs2
“解决这个问题的唯一方法是使用具有使用Unicode字符大小相同建一个Python二进制编译的扩展模块。”
它可能为你测试你的蟒Unicode字符与规模:
import sys
if sys.maxunicode > 65535:
print 'UCS4 build'
else:
print 'UCS2 build'
很抱歉这么晚才回复,因为我有学校工作。我试过测试我的python的Unicode大小,它是'UCS4 build',它需要是UCS2,对吗?那么,你确切知道该怎么做? –
好吧,从源代码重新安装python(使用--prefix =/usr/local不会干扰系统Python),或者从原始Ubuntu软件包(http://superuser.com/questions/24326/)构建自己的deb文件如何对修改-A-DEB包) 如果重新安装源的蟒蛇,使用: ”运行./configure --enable-unicode的UCS2' = 配置建立与UCS2支持的来源。 (但ucs2是默认值...因此它没有必要......)s) – FBruynbroeck
我已经从源代码重新安装了我的python,并检查它是否是UCS2版本,它是。我添加了'-DPYTHON_EXECUTABLE:FILEPATH =/usr/local/bin/python2'到cmake,但仍然得到相同的错误。我认为这个错误是vim使用的python解释器,因为当我查看vim使用的是UCS4构建(我的默认python)时。 –