运行 python 时 GVIM 崩溃 [英] GVIM crashes when running python

查看:20
本文介绍了运行 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:

让 $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:Python27Lib;C:Python27DLLs;C:Python27Liblib-tk

可以使用以下方法之一设置变量:

The variable can be set using one of the following:

设置HKEY_LOCAL_MACHINESOFTWAREWow6432NodePythonPythonCore2.7PythonPath键的默认值

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

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:

让 $PYTHONPATH = "C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk"

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆