本文介绍了运行python时GVIM崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能在GVIM中使用python。当我键入:
:python print 1 时,它只是关闭GVIM而没有任何消息。我试过使用 -V90logfile 运行它,但找不到有关崩溃的任何信息。

I cannot use python in GVIM. When I type::python print 1 it just closes GVIM without any message. I triend to run it with -V90logfile but I couldn't find any information about the crash.

GVIM是用python编译(:version 显示 + python / dyn + python3 / dyn )。

GVIM is compiled with python (:version shows +python/dyn +python3/dyn).

GVIM版本:7.3.46(带OLE的32位)。
Python版本:2.7.3

GVIM version: 7.3.46 (32 bit with OLE).Python version: 2.7.3

最初GVIM找不到python27.dll,所以我编辑了 $ MYVIMRC 并添加:

Initially GVIM couldn't find python27.dll so I edited $MYVIMRC and added:

let $ Path = C:\\Program Files(x86)\\Python27;。 $ Path

GVIM和Python都是使用公司标准安装的,而不是通过安装程序手动安装的。在这里问,因为IT部门无法帮助我,因此重定向到了外部支持。

Both GVIM and Python have been installed using corporate standards - not manually via installers. Asking here as IT were not able to help me and redirected to external support.

我可以在个人计算机上重现该错误,在该计算机上我同时复制了GVIM和PYTHON无需安装它们。

I could reproduce the error on my personal computer, where I copied both GVIM & PYTHON without installing them. Any further suggestions?

推荐答案

最终解决了问题。

它事实证明,Python使用 PYTHONPATH 变量来解析PYTHON文件夹(用于加载python库等)。这是Python 2.7的默认值:

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:

设置默认值 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\PythonPath

创建环境变量 PYTHONPATH 并设置值(与编辑全局相同)路径

Create environment variable PYTHONPATH and set the value (same as you edit global PATH)

这是最可移植的方法。编辑您的_vimrc(即打开vim并输入:e $ MYVIMRC 命令)并设置变量:

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

这篇关于运行python时GVIM崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-17 00:04