我有安装
首先我运行了
此外,我在另一个平台上发布了类似的问题,并尝试了许多方法来解决这个问题。然而,问题仍然存在。
vim
和 python 3
的问题,我在MacOS上。我知道这个主题上有一个类似的问题,但我无法解决这个问题。首先我运行了
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
此外,我在另一个平台上发布了类似的问题,并尝试了许多方法来解决这个问题。然而,问题仍然存在。
~/.zshrc
或~/.bashrc
中设置alias python=python3
,然后运行brew install vim
命令,确保which vim
的输出为/usr/local/bin/vim
,这样就可以支持 python3 了。来源:https://clay-atlas.com/us/blog/2021/09/04/mac-os-en-install-vim-support-python3/ - Morris