C'est sur OS X 10.8.4. Lorsque vous essayez d'utiliser powerline dans vim avec homebrew python 2.7.5 lié, les résultats de traçabilité suivants :
goldfish:~ goldfish$ brew link python
Linking /usr/local/Cellar/python/2.7.5... 34 symlinks created
goldfish:~ goldfish$ vim
Error detected while processing /Users/goldfish/.vimrc:
line 70:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/goldfish/Library/Python/2.7/lib/python/site-packages/powerline/__init__.py", line 9, in <module>
from powerline.lib.config import ConfigLoader
File "/Users/goldfish/Library/Python/2.7/lib/python/site-packages/powerline/lib/config.py", line 3, in <module>
from powerline.lib.threaded import MultiRunnedThread
File "/Users/goldfish/Library/Python/2.7/lib/python/site-packages/powerline/lib/threaded.py", line 5, in <module>
from powerline.lib.monotonic import monotonic
File "/Users/goldfish/Library/Python/2.7/lib/python/site-packages/powerline/lib/monotonic.py", line 22, in <module>
import ctypes
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so, 2): Symbol not found: __PyInt_AsInt
Referenced from: /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so
line 71:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'powerline_setup' is not defined
line 72:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'powerline_setup' is not defined
Press ENTER or type command to continue
La section pertinente de mon .vimrc
:
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
L'utilisation du système python ( brew unlink python
) fonctionne.
Je ne sais pas comment, malheureusement, mais le redémarrage d'iTerm a résolu le problème comme par magie.
redémarrer iTerm +1 ... 😢
Ce problème peut survenir lorsque vous installez une nouvelle version de python. Dans ces cas, vous devrez peut-être exécuter hash -r python
pour dire à bash de réinitialiser l'emplacement mis en cache sur l'exécutable python.
Commentaire le plus utile
Je ne sais pas comment, malheureusement, mais le redémarrage d'iTerm a résolu le problème comme par magie.