gvim支持python3编译,解决omnicppcomplete中python3complete报错:requried vim complied with +python3
2020-04-07 12:24
1841 查看
软件版本:
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 support For 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:\Python36 DYNAMIC_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.mak PYTHON3=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!
- 点赞 1
- 收藏
- 分享
- 文章举报
相关文章推荐
- 4年级开始学python的学习记录20200316
- 4年级开始学python的学习记录20200317
- 4年级开始学python的学习记录20200318
- 4年级开始学python的学习记录2020024
- 4年级开始学python的学习记录20200330
- 4年级开始学python的学习记录20200401
- 4年级开始学python的学习记录20200404
- python的构造函数
- 爬虫代码详解Python多线程、多进程、协程
- 不就是用Python做个动态图吗?看招
- anaconda+uwsgi报错Fatal Python error: initfsencoding: Unable to get the locale encoding
- Python每日一练(5)-百词斩
- python多线程测试接口性能,就是这么简单
- Python中的Lambda表达式
- numpy数组操作示例——2、b开头
- Python在终端通过pip安装好包以后,在Pycharm中依然无法使用的解决办法
- Python爬虫Requests模块中text和content的解码
- 在学习并使用python时候,遇见的问题,统计问题并解答(持续更新中),欢迎留言探讨
- Python之渗透测试笔记(二)——python-nmap模块
- 原来用的python环境改成anaconda中的虚拟环境