ubuntu 14.04 : VIM with YouCompleteMe plugin, throw “ImportError: No module named _io”

ε祈祈猫儿з 提交于 2019-12-12 01:55:00

问题


I was using python2.7.6, VIM 7.4 and YouCompleteMe plugin on my Ubuntu14.04. Today I did some update on my Ubuntu, but after that, I found my VIM cannot work properly with YouCompleteMe.

When I start vim, it throws following error on my screen:

Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 563, in <module> main()
File "/usr/lib/python2.7/site.py", line 545, in main  
     known_paths = addusersitepackages(known_paths)
File "/usr/lib/python2.7/site.py", line 272, in addusersitepackages
    user_site = getusersitepackages()
File "/usr/lib/python2.7/site.py", line 247, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
file "/usr/lib/python2.7/site.py", line 237, in getuserbase
        USER_BASE = get_config_var('userbase')
File "/usr/lib/python2.7/sysconfig.py", line 578, in get_config_var
    return get_config_vars().get(name)
File "/usr/lib/python2.7/sysconfig.py", line 524, in get_config_vars
      _init_posix(_CONFIG_VARS)
File "/usr/lib/python2.7/sysconfig.py", line 408, in _init_posix
    from _sysconfigdata import build_time_vars
File "/usr/lib/python2.7/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_nd import *
ImportError: No module named _sysconfigdata_nd

I looked through some questions on stackoverflow, and did following things:

sudo ln -s /usr/lib/python2.7/plat-*/_sysconfigdata_nd.py /usr/lib/python2.7/

Then after that, I restart VIM. This time, it throws following error:

Handle function youcompleteme#Enable..<SNR>52_SetUpPython error
line 6:
Traceback (most recent call last):
hanle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
  File "<string>", line 1, in <module>
hanle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
  File "/home/lizhuohua/.vim/bundle/YouCompleteMe/autoload/../third_party/ycmd/ycmd/utils.py", line 20, in <module>
handle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
    import tempfile
handle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
  File "/usr/lib/python2.7/tempfile.py", line 32, in <module>
handle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
    import io as _io
handle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
  File "/usr/lib/python2.7/io.py", line 51, in <module>
handle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
    import _io
handle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
ImportError: No module named _io
  File "/usr/lib/python2.7/io.py", line 51, in <module>
handle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
    import _io
handle function youcompleteme#Enable..<SNR>52_SetUpPython error:
line 6:
ImportError: No module named _io

I tried to upgrade my python virtualenv:

sudo pip install virtualenv --upgrade
Requirement already up-to-date: virtualenv in /usr/local/lib/python2.7/dist-packages
Cleaning up...

But it still doesn't work for my issue.

What should I do next to fix this issue?

来源:https://stackoverflow.com/questions/27031170/ubuntu-14-04-vim-with-youcompleteme-plugin-throw-importerror-no-module-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!