Closed jlintz closed 6 years ago
:python print(sys.path)
?
Feel free to crawl through our isue tracker. there's a lot of people with issues on OSX.
Did you 'pip install jedi' before you use the plugin?
@davidhalter ah looks like the path is wrong in VIM but correct from the cmdline, any idea how I can modify the path that it's using inside VIM? Thanks
I have no idea. Some VIM versions on MacOS seem to be broken.
@jlintz
I'm using this small script to detect system site-packages, virtualenv and modules inside current directory (using this script instead vim-virtualenv):
if has('python')
py << EOF
import os
import os.path, sys
import vim
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
sys.path.insert(0, project_base_dir)
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
python_version = os.listdir(project_base_dir + '/lib')[0]
site_packages = os.path.join(project_base_dir, 'lib', python_version, 'site-packages')
current_directory = os.getcwd()
sys.path.insert(1, site_packages)
sys.path.insert(1, current_directory)
EOF
endif
(It works fine for me).
Example for activated virtualenv:
(:python import sys; print sys.path)
['/Users/aliev/Projects/dede/.env/lib/python2.7/site-packages', '/Users/aliev/Projects/dede', '/Users/aliev/Projects/dede/.env/lib/python2.7/site-packages', '/Users/aliev/Project
s/dede/.env', '/Users/aliev/Projects/sentry/src', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/pyt
hon2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Fram
eworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Py
thon.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/
2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages', '_vim_path_']
Also try to install vim from the sources.
@aliev Where should I'll be created this script? Within the .vimrc or is a shell script?
@rogeriofonseca just add it inside vimrc
Ok. Now that virtualenv support is part of Jedi itself (and we merged it in jedi-vim), I feel like this is not an issue anymore. Please open a new issue if you are still having this (we have updated a lot of our debug scripts to help us with understanding your issues).
Issue
in OSX El Capitan, pip is installing modules to
/usr/local/lib/python2.7/site-packages/
, my PYTHONPATH contains the followingbut autocomplete is not able to work on any modules inside this directory, but works fine for modules installed in
/Library/Python/2.7/site-packages
. Unsure why it can't find the modules in that directoryVersions
Output of "scriptnames" Vim command