gvim支持python3编译,解决omnicppcomplete中python3complete报错:requried vim complied with +python3
生活随笔
收集整理的这篇文章主要介绍了
gvim支持python3编译,解决omnicppcomplete中python3complete报错:requried vim complied with +python3
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
软件版本:
gvim82,python3.6,mingw-w64(gcc 8.1)问题描述:
1、在_vimrc文件中添加: autocmd Filetype python set omnifunc=python3complete#Complete autocmd Filetype python inoremap <buffer>. .<C-X><C-O> 2、编辑hello.py文件,输入 sys. , 便会报错requried vim complied with +python3原因分析:
控制台输入gvim --version,可以看到-python,-python3。 -号表示不支持,+号表示支持。 原因是gvim8以后版本,安装包默认不支持python。 所以通过gvim源码编译生成gvim.exe时需要增加Python支持。解决方案:
1、首先从官网(http://www.vim.org)下载vim82src源码,以及下载gvim82.exe安装包。 2、安装gvim82.exe,然后控制台输入gvim --version,可见-python3。 3、windows下需要安装mingw-w64(gcc编译环境),控制台输入mingw32-make --version保证安装成功。 4、源码vim82src/vim/vim82/src/INSTALLpc.txt,详细介绍了编译过程: ================================ Building with Python3 supportFor building with MSVC the "Windows Installer" from www.python.org works fine. Python 3.6 is recommended.When building, you need to set the following variables at least:PYTHON3: Where Python3 is installed. E.g. C:\Python36DYNAMIC_PYTHON3: Whether dynamic linking is used. Usually, set to yes.PYTHON3_VER: Python3 version. E.g. 36 for Python 3.6.X.When using MinGW and link with the official Python3 (as one line):mingw32-make -f Make_ming.makPYTHON3=C:/Python36 DYNAMIC_PYTHON3=yes PYTHON3_VER=36 ================================ 5、以下介绍我的编译过程: (1)修改vim82src/vim/vim82/src/Make_cyg_ming.mak文件,查找ARCH,将其设置为ARCH=x86-64(注意删除#号)。 (2)控制台cd到vim82src/vim/vim82/src文件夹,然后执行: mingw32-make -f Make_ming.mak PYTHON3=C:/Python36 DYNAMIC_PYTHON3=yes PYTHON3_VER=36 gvim.exe 需注意python的安装路径要修改。 6、将gvim.exe拷贝到vim82安装路径中,替换原有的。 7、控制台输入gvim --version,可以看到+python3。 8、打开hello.py,在输入sys.,即可实现自动补全。如果要支持python2及其他语言的话,可以参考INSTALLpc.txt。
接下来,开始enjoy coding with vim!
总结
以上是生活随笔为你收集整理的gvim支持python3编译,解决omnicppcomplete中python3complete报错:requried vim complied with +python3的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 基于Bert的图书分类项目
- 下一篇: 基于Python(sklearn)计算P