これはOSX10.8.4にあります。 homebrew python 2.7.5がリンクされたvimで電力線を使用しようとすると、次のトレースバックが発生します。
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
私の.vimrc
の関連セクション:
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
システムpython( brew unlink python
)の使用は機能します。
残念ながら、その方法はわかりませんが、iTermを再起動すると問題が魔法のように修正されました。
iTerm + 1を再起動します...😢
この問題は、新しいバージョンのpythonをインストールするときに発生する可能性があります。 そのような場合は、 hash -r python
を実行して、キャッシュされた場所をpython実行可能ファイルにリセットするようにbashに指示する必要があります。
最も参考になるコメント
残念ながら、その方法はわかりませんが、iTermを再起動すると問題が魔法のように修正されました。