It's an ad hoc solution. I think the details are wrong, but for the time being, this worked, so I will summarize it. Please let me know if there is a good or correct method.
brew install python3
and --with-properly-linked-python2-python3
, when you open the python file, Segmentaion faultbrew install macvim
only installs the pre-built one, so get the source code from the macvim repository and build and install it.
$ brew tap macvim-dev/macvim
If you install normally with pyenv, the DLL required to build MacVim will not be created, so add the following environment variables and build. python3 gives an error such as -undefined dynamic_lookup
is missing and pip install greenlet
.
** Change the version number to the one you are using. ** **
PYTHON_CONFIGURE_OPTS="--enable-shared" \
LDSHARED="clang -bundle" \
LDCXXSHARED="clang++ -bundle" \
BLDSHARED="clang -bundle -lpython2.7" \
pyenv install 2.7.12
PYTHON_CONFIGURE_OPTS="--enable-shared" \
LDSHARED="clang -undefined dynamic_lookup -bundle"\
LDCXXSHARED="clang++ -undefined dynamic_lookup -bundle" \
BLDSHARED="clang -bundle -undefined dynamic_lookup -lpython3.5m" \
pyenv install 3.5.2
Since the build argument is set in the source code, rewrite the source code with brew edit. (It took me a day to notice because I'm new to brew.)
$ brew edit macvim-dev/macvim/macvim
The Ruby code will be displayed, so change the def install at the top. The commented out part is the default value. Since you can only see Python3 installed by Homebrew, change the path to refer to Python3 of pyenv. Since python2 also tries to refer to the MacOS System library, add variables and paths so that python2 also refers to python2 in pyenv. ** Change the enushi part to your own username. ** **
def install
perl_version = '5.16'
ENV.append 'VERSIONER_PERL_VERSION', perl_version
ENV.append 'VERSIONER_PYTHON_VERSION', '2.7'
ENV.append 'vi_cv_path_python', "/Users/enushi/.pyenv/versions/2.7.10/bin/python2"
ENV.append 'vi_cv_path_python3', "/Users/enushi/.pyenv/versions/3.4.3/bin/python3"
ENV.append 'vi_cv_path_plain_lua', "#{HOMEBREW_PREFIX}/bin/lua"
ENV.append 'vi_cv_dll_name_perl', "/System/Library/Perl/#{perl_version}/darwin-thread-multi-2level/CORE/libperl.dylib"
ENV.append 'vi_cv_dll_name_python3', "/Users/enushi/.pyenv/versions/3.4.3/lib/libpython3.4m.dylib"
ENV.append 'vi_cv_dll_name_python', "/Users/enushi/.pyenv/versions/2.7.10/lib/libpython2.7.dylib"
#ENV.append 'vi_cv_path_python3', "#{HOMEBREW_PREFIX}/bin/python3"
#ENV.append 'vi_cv_path_plain_lua', "#{HOMEBREW_PREFIX}/bin/lua"
#ENV.append 'vi_cv_dll_name_perl', "/System/Library/Perl/#{perl_version}/darwin-thread-multi-2level/CORE/libperl.dylib"
#ENV.append 'vi_cv_dll_name_python3', "#{HOMEBREW_PREFIX}/Frameworks/Python.framework/Versions/3.5/Python"
--with-properly-linked-python2-python3
is required.
--with-override-system-vim
is an option that replaces the default vim (vim running on the console) in the OS with mvim -v
. Use it as you like.
brew install --HEAD --with-properly-linked-python2-python3 --with-override-system-vim macvim-dev/macvim/macvim
Start mvim and execute the following command.
:python print(sys.path)
:py3 print(sys.path)
The output path should be pyenv's python. Also, if it can be executed continuously, the effect of --with-properly-linked-python2-python3
is obtained.
Well then. Happy Vim Life
Recommended Posts