我在为vim
安装python 3
和MacOS
时遇到麻烦。我知道在该主题上也有类似的similar question。但我无法解决问题
首先我运行vim --version
并获得
Included patches: 1-503, 505-680, 682-1283
Compiled by root@apple.com
Normal version without GUI. Features included (+) or not (-):
+acl +file_in_path -mouse_sgr +tag_old_static
-arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float -mouse_urxvt -tcl
-balloon_eval +folding +mouse_xterm -termguicolors
-browse -footer +multi_byte -terminal
+builtin_terms +fork() +multi_lang +terminfo
+byte_offset -gettext -mzscheme +termresponse
+channel -hangul_input +netbeans_intg +textobjects
+cindent +iconv +num64 +timers
-clientserver +insert_expand +packages +title
-clipboard +job +path_extra -toolbar
+cmdline_compl +jumplist -perl +user_commands
+cmdline_hist -keymap +persistent_undo +vertsplit
+cmdline_info +lambda +postscript +virtualedit
+comments -langmap +printer +visual
-conceal +libcall -profile +visualextra
+cryptv +linebreak +python/dyn +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua -rightleft +windows
+diff +menu +ruby/dyn +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
-emacs_tags -mouseshape +startuptime -xpm
+eval -mouse_dec +statusline -xsmp
+ex_extra -mouse_gpm -sun_workshop -xterm_clipboard
+extra_search -mouse_jsbterm +syntax -xterm_save
-farsi -mouse_netterm +tag_binary
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa
,这是我的Mac上安装的默认vim
版本。不幸的是,它说:-python3
。因此,我假设未安装python 3。所以我做了以下事情:
brew remove vim
一切顺利,然后
brew info vim
并收到以下消息:
vim: stable 8.1.1550 (bottled), HEAD
Vi 'workalike' with many additional features
https://www.vim.org/
Conflicts with:
ex-vi (because vim and ex-vi both install bin/ex and bin/view)
macvim (because vim and macvim both install vi* binaries)
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/vim.rb
==> Dependencies
Required: gettext ✔, lua ✔, perl ✔, python ✔, ruby ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 89,945 (30 days), 222,053 (90 days), 835,730 (365 days)
install_on_request: 82,933 (30 days), 204,131 (90 days), 747,520 (365 days)
build_error: 0 (30 days)
是因为现在安装了两个版本的vim
吗?
我也尝试了brew install vim --with-python3
,但收到了以下消息
invalid option: --with-python3
输入vim --version
时,我得到:
vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 22 2019 19:03:04)
Included patches: 1-503, 505-680, 682-1283
Compiled by root@apple.com
编辑
以下是带有相应输出的命令
sudo nano /etc/paths
:/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
command -v vim
:/usr/bin/vim
$PATH
:-bash: /Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin: No such file or directory
此外,我在another platform上发布了类似的问题,并做了很多尝试来尝试解决该问题。但是问题仍然存在。
答案 0 :(得分:1)
您正在运行的Vim版本是内置的Apple版本,您可以在第二行中看到它(“由root@apple.com编译”)。您可以使用Homebrew安装window.open('/requestURL')
或vim
软件包,它们将内置Python 3,因为正如ParthS007所述,默认的Python是Python 3。
但是,如果要在默认系统版本上使用Homebrew版本,您的macvim
环境变量将必须在PATH
之前有/usr/local/bin
(几乎可以肯定)。您可以编辑外壳配置以更改设置,然后重新启动终端会话。
如果您的/usr/bin
环境变量设置正确,则可能还必须运行PATH
(或brew link vim
)来创建适当的符号链接。通常,您会希望brew link macvim
显示command -v vim
。手动运行/usr/local/bin/vim
应该显示正确的Vim安装。