ImportError: No module named site VIM and Enthought canopy

有些话、适合烂在心里 提交于 2019-12-11 01:48:31

问题


I was using vim and python perfectly fine till I upgrade to Maverick. Now I have a similar issue as here. When I remove remove canopy path from bash_profile and use default python path , vim works fine, otherwise I am getting the above error. You can also see me report on jedi-vim here

UPDATE: Also it seems my default python path is no longer in /Library/Frameworks/Python.framework/Versions/2.7/bin

$ which python
/usr/bin/python

回答1:


For anyone encountering this issue I resolved the problem by putting these lines into .profile:

export PYTHONDIR=/Library/Frameworks/Python.framework/Versions/2.7/bin
export PYTHONPATH=$PYTHONPATH:/Library/Frameworks/Python.framework/Versions/2.7/bin
export PYTHONPATH=$PYTHONPATH:/Users/mj/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
export PYTHONPATH=$PYTHONPATH:/Applications/Canopy.app/appdata/canopy-1.0.1.1189.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages

Now it works fine. In this way I can manage my python module with canopy and use default python. NOTE: I don't feel this is the best solution but at least solved my problem after 8h.




回答2:


please check existence of site directory under

/usr/local/lib/python2.7/

Hint: python version below 2.7 does not have the jedi-vim support, so better disable jedi-vim and try

If the problem still persisting remove your existing python and try re-installing it

even though your default python is /usr/bin/python you can specify at the start of your file

`#! /usr/bin/python2.7`

$ ls /usr/bin/py
python3   python3.3   python   python2   python2.7
....


来源:https://stackoverflow.com/questions/19617936/importerror-no-module-named-site-vim-and-enthought-canopy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!