我正在尝试为linux设置pip。 我在系统上有python 12.7.12,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****
答案 0 :(得分:2)
这通常是Python安装冲突/错误的症状,而不是Pip。 I.E.它们的构建和编译方式不同。
您是否安装了多个Python(或者安装了Travis CI /定制安装)?
供参考 - here is a similar issue on the Pip bug tracker
我建议您在尝试运行Python时检查Python安装的引用 - 您可以使用以下内容:
select seq_table1.nextval into table1 form dual
和/或者看看使用virtualenv来隔离你正在执行的python环境。
作为另一个参考,我再次相信this SO question的类似问题。