Complement the library you put in anaconda with jedi-vim

environment

You are using pyenv and virtualenv is unused

PYENV_ROOT is directly under your home directory

Thing you want to do

By default, jedi-vim, which is a plugin of vim, refers to python of the system even if python used by pyenv etc. is switched. For this reason, it does not complement the library installed in python set in anaconda or pyenv. I want to complement this.

solution

jedi-vim complements the library in python's sys.path, so if you add anaconda's site-packages here, it will be complemented. There are two solutions, one is to rewrite sys.path directly when reading the python file with ftplugin, and the other is to have the pth file read.

ftplugin Put python.vim in the .vim / ftplugin folder

python << EOF
import os
import sys

path = os.path.expanduser("~/.pyenv/versions/anaconda-2.3.0/lib/python2.7/site-packages")
if not path in sys.path:
	sys.path.append(path)
EOF

Use pth file

Place the reference as anaconda.pth (anything is fine if the file name is .pth) under /Library/Python/2.7/site-packages You need sudo privileges to edit in / Library / Python / site-packages

~/.pyenv/versions/anaconda-2.3.0/lib/python2.7/site-packages

Verification

If you start vim and execute the following, if the added path is included, it is successful.

:py print(sys.path)

Recommended Posts

Complement the library you put in anaconda with jedi-vim
What you can do with the Python standard library statistics
If you think that the person you put in with pip doesn't work → Maybe you are using python3?
Until you put Python in Docker
Put the module in the Pepper app
Put postfix 2.11 in source with ansible
Until you put pyaudio in Mavericks
When using the zap library in your own Logger with Golang, how to put the hierarchy above Logger in Caller
Move the turtle to the place where you click the mouse with turtle in Python
Behavior when returning in the with block
Put TensorFlow in P2 instance with pip3
Put together consecutive values in the list
Display Python 3 in the browser with MAMP
Put Japanese fonts in images with Colaboratory
The result of installing python in Anaconda
What is "mahjong" in the Python library? ??
How to pass the path to the library built with pyenv and virtualenv in PyCharm
Make the library created by Eigen in C ++ available from Python with Boost.Numpy.
If you guys in the scope kitchen can do it with a margin ~ ♪
Location information data display in Python --Try plotting with the map display library (folium)-
How to use the C library in Python
Log in to the remote server with SSH
[Python] Get the files in a folder with Python
Load the network modeled with Rhinoceros in Python ③
[Automation] Extract the table in PDF with Python
Until you use the Kaggle API with Colab
Until you run the changefinder sample in python
Determine the numbers in the image taken with the webcam
Detect folders with the same image in ImageHash
Manage AWS nicely with the Python library Boto
Load the network modeled with Rhinoceros in Python ②
Put the second axis in 2dhistgram of matplotlib
Use Python in Anaconda environment with VS Code
An app that you must put in Linux
Use the LibreOffice app in Python (3) Add library
[Modint] Decoding the AtCoder Library ~ Implementation in Python ~
Load the network modeled with Rhinoceros in Python ①
The story that fits in with pip installation
Put Scipy + Matplotlib in Ubuntu on Vagrant and display the graph with X11 Forwarding
What I did when I was angry to put it in with the enable-shared option