2017-07-18 193 views
1

我正在嘗試設置linux的pip。 我對系統蟒蛇12.7.12,PIP是系統即使安裝正確,pip也不能正常工作

~/Desktop # sudo easy_install pip 
install_dir /usr/local/lib/python2.7/site-packages/ 
Searching for pip 
Best match: pip 9.0.1 
Processing pip-9.0.1-py2.7.egg 
pip 9.0.1 is already the active version in easy-install.pth 
Installing pip script to /usr/local/bin 
Installing pip2.7 script to /usr/local/bin 
Installing pip2 script to /usr/local/bin 

從這裏上安裝它看起來PIP正確安裝,但是當我試圖使用PIP那麼它會拋出錯誤。

pip -V 
Traceback (most recent call last): 
File "/usr/local/bin/pip", line 9, in <module> 
    load_entry_point('pip==9.0.1', 'console_scripts', 'pip')() 
File "/usr/local/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 305, in load_entry_point 
    return get_distribution(dist).load_entry_point(group, name) 
File "/usr/local/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 2244, in load_entry_point 
    return ep.load() 
File "/usr/local/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 1954, in load 
    entry = __import__(self.module_name, globals(),globals(), ['__name__']) 
File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/__init__.py", line 28, in <module> 
    from pip.vcs import git, mercurial, subversion, bazaar # noqa 
File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/vcs/mercurial.py", line 9, in <module> 
    from pip.download import path_to_url 
File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 36, in <module> 
    from pip.utils.glibc import libc_ver 
File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/glibc.py", line 4, in <module> 
    import ctypes 
File "/usr/local/lib/python2.7/ctypes/__init__.py", line 7, in <module> 
    from _ctypes import Union, Structure, Array 
****ImportError: /usr/local/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: PyUnicodeUCS2_FromUnicode**** 

回答

2

這通常是一個矛盾的/錯誤的Python安裝的症狀,而不是Pip。 I.E.它們的構建和編譯方式不同。

你有多個Python安裝(或類似Travis CI安裝/定製安裝)?

僅供參考 - here is a similar issue on the Pip bug tracker

我建議你檢查什麼,當你嘗試並運行它的Python安裝Python是參考 - 你可以使用類似:

import sys 
print(sys.executable) 

和/或看看使用的virtualenv隔離你正在執行的python環境。

作爲另一個參考,我再次相信類似的問題this SO question

+0

謝謝,我做了一個乾淨的安裝我的系統,然後只有1版本的Python在那裏,一切正常。 – hellrocker

+0

@hellrocker太棒了,很高興你能工作! – welshGaz

相關問題