安装好YouCompleteMe后报错RequestsDependencyWarning: Old version of cryptography,Error detected 35_Pyeval

安装YouCompleteMe后报错。

".vimrc" 95L, 3653C
Error detected while processing function <SNR>35_PollServerReady[7]..<SNR>35_Pyeval:
line    4:
/home/lenovo/.vim/bundle/YouCompleteMe/third_party/requests_deps/requests/requests/__init__.py:83: RequestsDependencyWarning: Old versi
on of cryptography ([1, 2, 3]) may cause slowdown.

解决方法

安装python2.7的pip包管理器,用python2.7升级一下cryptography,就是这里,我习惯性用了pip3,所以浪费了好一会,记住是python2.7的pip。

sudo apt install python-pip
sudo pip install --upgrade cryptography

vim ~/.vimrc
# 在vimrc加入下面这行代码告诉vim,ycm用的是python2.7
let g:ycm_server_python_interpreter = '/usr/bin/python2.7'

退出编辑,执行source命令重新加载一下vimrc,source ~/.vimrc

又报其他error

Error detected while processing function <SNR>27_RestartServer:
line    3:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/lenovo/.vim/bundle/YouCompleteMe/python/ycm/youcompleteme.py", line 291, in RestartServer
    self._ShutdownServer()
  File "/home/lenovo/.vim/bundle/YouCompleteMe/python/ycm/youcompleteme.py", line 286, in _ShutdownServer
    SendShutdownRequest()
  File "/home/lenovo/.vim/bundle/YouCompleteMe/python/ycm/client/shutdown_request.py", line 45, in SendShutdownRequest
    request.Start()
  File "/home/lenovo/.vim/bundle/YouCompleteMe/python/ycm/client/shutdown_request.py", line 39, in Start
    display_message = False )
  File "/home/lenovo/.vim/bundle/YouCompleteMe/python/ycm/client/base_request.py", line 138, in PostDataToHandler
    BaseRequest.PostDataToHandlerAsync( data, handler, timeout ),
  File "/home/lenovo/.vim/bundle/YouCompleteMe/python/ycm/client/base_request.py", line 148, in PostDataToHandlerAsync
    return BaseRequest._TalkToHandlerAsync( data, handler, 'POST', timeout )
  File "/home/lenovo/.vim/bundle/YouCompleteMe/python/ycm/client/base_request.py", line 169, in _TalkToHandlerAsync
    return BaseRequest.Session().post(
  File "/home/lenovo/.vim/bundle/YouCompleteMe/python/ycm/client/base_request.py", line 217, in Session
    from requests_futures.sessions import FuturesSession
  File "/home/lenovo/.vim/bundle/YouCompleteMe/third_party/requests-futures/requests_futures/sessions.py", line 24, in <module>
    from requests import Session
  File "/home/lenovo/.vim/bundle/YouCompleteMe/third_party/requests_deps/requests/requests/__init__.py", line 95, in <module>
    from urllib3.contrib import pyopenssl
  File "/home/lenovo/.vim/bundle/YouCompleteMe/third_party/requests_deps/urllib3/src/urllib3/contrib/pyopenssl.py", line 46, in <module
>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in <module>
    SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

又一个模块升级一下
sudo python -m easy_install --upgrade pyOpenSSL

原因分析

安装YouCompleteMe的时候我用的是python3 ./install.py安装的,也就是用的python3,但是ycm的内核使用python2编译的,所以我就得好像也看到有过这样一条报错。
YCM core library compiled for Python 2 but loaded in Python 3
所以里面有很多python2和python3的移植有点问题,解决办法就是指定YCM使用python2.7。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值