支持python2.7.3的自制macvim不工作

2024-05-14 21:58:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我安装了macvim和自制软件,并支持python。我的咒语如下:

brew install macvim --override-system-vim

现在,当我打开一个python文件时,如果我尝试导入任何内容,就会出现一系列错误。e、 g.如果我import re我看到ImportError: no module name re

安装后第一次打开macvim时,我在打开macvim的终端中得到'import site' failed; use -v for traceback。这是在运行我的第一个python命令之后。

这是什么意思?我该怎么解决?


Tags: install文件noimportre内容软件错误
3条回答

我最终放弃了自制的选项,并使用了这里建议的答案:

vim compiles with wrong python version (and not working with needed version)

遗憾的是,这似乎无法通过酿造完成。看来有人需要修补macvim发行版本身。

我使用了一个快速的技巧,将系统python临时指向您喜欢的python:

cd /System/Library/Frameworks/Python.framework/Versions
sudo mv Current Current-sys
sudo mv 2.7 2.7-sys
sudo ln -s /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7 Current
sudo ln -s /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7 2.7

brew rm macvim # optionall, only if you had it installed previously  
brew install macvim --override-system-vim

sudo mv Current-sys Current
sudo mv 2.7-sys 2.7

我的猜测是,您应该将homebrew安装文件夹添加到.bash_配置文件中,如下所示:

export PATH=/usr/local/bin:/usr/local/sbin:usr/local/Cellar/python/2.7.3/bin:$PATH

之后,在shell中写入“source.bash_profile”,以便重新加载。也请检查输出

which python 

确保使用的是自制python

相关问题 更多 >

    热门问题