http://stackoverflow.com/questions/35597157/gvim-crashes-when-running-python 写道
Finally solved the problem.
It turned out that Python uses PYTHONPATH variable to resolve the PYTHON folder (used to load python libraries and so on). Here is the default value for Python 2.7:
C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk
The variable can be set using one of the following:
1. Windows registry
Set the default value of HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\PythonPath key
2. Environment variable
Create environment variable PYTHONPATH and set the value (same as you edit global PATH)
3. _vimrc file
This is the most portable way. Edit your _vimrc (i.e. open vim and enter :e $MYVIMRC command) and set the variable:
let $PYTHONPATH = "C:\\Python27\\Lib;C:\\Python27\\DLLs;C:\\Python27\\Lib\\lib-tk"
It turned out that Python uses PYTHONPATH variable to resolve the PYTHON folder (used to load python libraries and so on). Here is the default value for Python 2.7:
C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk
The variable can be set using one of the following:
1. Windows registry
Set the default value of HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\PythonPath key
2. Environment variable
Create environment variable PYTHONPATH and set the value (same as you edit global PATH)
3. _vimrc file
This is the most portable way. Edit your _vimrc (i.e. open vim and enter :e $MYVIMRC command) and set the variable:
let $PYTHONPATH = "C:\\Python27\\Lib;C:\\Python27\\DLLs;C:\\Python27\\Lib\\lib-tk"
本文详细介绍了gvim在运行Python脚本时出现崩溃的原因及解决方案。问题源于Python通过PYTHONPATH变量查找PYTHON文件夹来加载库等资源。文中提供了三种设置PYTHONPATH的方法:通过Windows注册表、环境变量以及_vimrc文件。

320

被折叠的 条评论
为什么被折叠?



