4
剛剛安裝了pip,但無法導入它。 OS是RedHat企業版,我也安裝了最新的openssl(從源代碼編譯)。ImportError:無法導入名稱HTTPSHandler
$ easy_install pip
Searching for pip
Best match: pip 8.1.1
Adding pip 8.1.1 to easy-install.pth file
Installing pip script to XXX/local/bin
Installing pip3.5 script to XXX/local/bin
Installing pip3 script to XXX/local/bin
Using XXX/local/lib/python2.7/site-packages
Processing dependencies for pip
Finished processing dependencies for pip
$ python
Python 2.7 (r27:82500, Apr 27 2016, 15:32:43)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "XXX/local/lib/python2.7/site-packages/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "XXX/local/lib/python2.7/site-packages/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "XXX/local/lib/python2.7/site-packages/pip/index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "XXX/local/lib/python2.7/site-packages/pip/wheel.py", line 39, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
File "XXX/local/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.py", line 14, in <module>
from .compat import sysconfig, detect_encoding, ZipFile
File "XXX/local/lib/python2.7/site-packages/pip/_vendor/distlib/compat.py", line 31, in <module>
from urllib2 import (Request, urlopen, URLError, HTTPError,
ImportError: cannot import name HTTPSHandler
我知道我必須配置我的OpenSSL的方式,它的工作原理與Python(據this)。我這是怎麼配置的OpenSSL之前,我編譯:
# openssl-1.0.2g
./config --prefix=XXX/local \
--openssldir=XXX/local/etc/ssl \
--libdir=lib \
shared \
zlib-dynamic \
-LXXX/local/lib \
-IXXX/local/include
Python版本是2.7
也許對你有所幫助:http://stackoverflow.com/questions/ 20688034 /導入錯誤,無法導入名-httpshandler-使用-PIP – Harpal