美文网首页
VIM搭建PYTHON开发环境

VIM搭建PYTHON开发环境

作者: Jedore | 来源:发表于2018-10-31 11:08 被阅读0次

参考

Vim与Python真乃天作之合:打造强大的Python开发环境

系统

CentOS 7.3

问题记录

PEP8
添加'|'符号

au BufNewFile,BufRead *.py
set tabstop=4 |
set softtabstop=4 |
set shiftwidth=4 |
set textwidth=79 |
set expandtab |
set autoindent |
set fileformat=unix

标示不必要的空白字符
添加

highlight BadWhitespace ctermbg=red guibg=darkred

退格键backspace不能退到前一行尾

set backspace=indent,eol,start

安装YouCompleteMe
执行vim提示

YouCompleteMe unavailable: requires Vim 7.4.1578+.

因为vim版本是7.4.160所以怀疑是不是安装ycm有问题,决定自己重新编译vim一下试试(结果不行,最后还是升级到vim8.0)
使用补全功能提示

YCM core library not...need to compile YCM before using it,

需重新编译YCM
进入YCM文件夹,执行 ./install.py
报错如下:

Searching Python 2.7 libraries...
Found Python library: /usr/lib64/python2.7/config/libpython2.7.so
Found Python headers folder: /usr/include/python2.7
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- NOTE: You appear to be on CentOS version 7.3.1611. In order to use this application, you require a more modern compiler than the default compiler on this platform. Please install the devtoolset-6 or greater. For example, see this link: https://www.softwarecollections.org/en/scls/rhscl/devtoolset-6/
CMake Error at CMakeLists.txt:217 (message):
Your C++ compiler does NOT fully support C++11.
-- Configuring incomplete, errors occurred!
See also "/tmp/ycm_build_sUJpgN/CMakeFiles/CMakeOutput.log".
ERROR: the build failed.

解决方案

  1. Install a package with repository for your system:
    On CentOS, install package centos-release-scl available in CentOS repository:
    $ sudo yum install centos-release-scl
    On RHEL, enable RHSCL repository for you system:
    $ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
  2. Install the collection:
    $ sudo yum install devtoolset-6
  3. Start using software collections:
    $ scl enable devtoolset-6 bash
    注意:要在同一个用户下执行3个命令
    执行 ./install.py
    报错如下:
    [ 74%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
    c++: internal compiler error: Killed (program cc1plus)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <http://bugzilla.redhat.com/bugzilla> for instructions.
    ycm/CMakeFiles/ycm_core.dir/build.make:172: recipe for target                 ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o' failed
    CMakeFiles/Makefile2:133: recipe for target 'ycm/CMakeFiles/ycm_core.dir/all' failed
    CMakeFiles/Makefile2:145: recipe for target 'ycm/CMakeFiles/ycm_core.dir/rule' failed
    Makefile:163: recipe for target 'ycm_core' failed
    gmake[3]: *** [ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o] Error 4
    gmake[2]: *** [ycm/CMakeFiles/ycm_core.dir/all] Error 2
    gmake[1]: *** [ycm/CMakeFiles/ycm_core.dir/rule] Error 2
    gmake: *** [ycm_core] Error 2
    ERROR: the build failed.
    
    解决方案
    sudo ./install.py 成功
    但是依然报错
    YouCompleteMe unavailable: requires Vim 7.4.1578+.
    
    升级vim到8.0,成功解决,参考

相关文章

网友评论

      本文标题:VIM搭建PYTHON开发环境

      本文链接:https://www.haomeiwen.com/subject/xyiotqtx.html