本文介绍了ImportError:无法使用Brew导入名称HTTPSHandler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置python env时遇到一些麻烦...我通过 brew 安装了python,但是当我尝试使用easy_install或pip安装某些东西时,出现此错误,在本示例中,我试图用pip安装软件包...

我正在将Macbook与Mavericks,python 2.7.8 ...

谢谢! :)

$ sudo pip install test
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 356, in load_entry_point
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2439, in load_entry_point
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2155, in load
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/__init__.py", line 10, in <module>
    from pip.util import get_installed_distributions, get_prog
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 18, in <module>
    from pip._vendor.distlib import version
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/distlib/version.py", line 14, in <module>
    from .compat import string_types
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/distlib/compat.py", line 31, in <module>
    from urllib2 import (Request, urlopen, URLError, HTTPError,
ImportError: cannot import name HTTPSHandler

brew list python

Joao-Carreira-Macbook-Pro:Desktop joaocarreira$ brew list python
/usr/local/Cellar/python/2.7.8/bin/2to3
/usr/local/Cellar/python/2.7.8/bin/2to3-2
/usr/local/Cellar/python/2.7.8/bin/2to3-2.7
/usr/local/Cellar/python/2.7.8/bin/easy_install
/usr/local/Cellar/python/2.7.8/bin/easy_install-2.7
/usr/local/Cellar/python/2.7.8/bin/idle
/usr/local/Cellar/python/2.7.8/bin/idle2
/usr/local/Cellar/python/2.7.8/bin/idle2.7
/usr/local/Cellar/python/2.7.8/bin/pip
/usr/local/Cellar/python/2.7.8/bin/pip2
/usr/local/Cellar/python/2.7.8/bin/pip2.7
/usr/local/Cellar/python/2.7.8/bin/pydoc
/usr/local/Cellar/python/2.7.8/bin/pydoc2
/usr/local/Cellar/python/2.7.8/bin/pydoc2.7
/usr/local/Cellar/python/2.7.8/bin/python
/usr/local/Cellar/python/2.7.8/bin/python-config
/usr/local/Cellar/python/2.7.8/bin/python2
/usr/local/Cellar/python/2.7.8/bin/python2-config
/usr/local/Cellar/python/2.7.8/bin/python2.7
/usr/local/Cellar/python/2.7.8/bin/python2.7-config
/usr/local/Cellar/python/2.7.8/bin/pythonw
/usr/local/Cellar/python/2.7.8/bin/pythonw2
/usr/local/Cellar/python/2.7.8/bin/pythonw2.7
/usr/local/Cellar/python/2.7.8/bin/smtpd.py
/usr/local/Cellar/python/2.7.8/bin/smtpd2.7.py
/usr/local/Cellar/python/2.7.8/bin/smtpd2.py
/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/ (3666 files)
/usr/local/Cellar/python/2.7.8/IDLE.app/Contents/ (8 files)
/usr/local/Cellar/python/2.7.8/libexec/pip/ (407 files)
/usr/local/Cellar/python/2.7.8/libexec/setuptools/ (252 files)
/usr/local/Cellar/python/2.7.8/Python Launcher.app/Contents/ (17 files)
/usr/local/Cellar/python/2.7.8/share/man/ (3 files)
/usr/local/Cellar/python/2.7.8/share/python/ (317 files)

简单安装-vd python

Joao-Carreira-Macbook-Pro:Desktop joaocarreira$ brew install -vd python 
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/python.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/pkg-config.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/readline.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/sqlite.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/gdbm.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/openssl.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/makedepend.rb
Warning: python-2.7.8 already installed, it's just not linked
解决方案

在使用brew(brew install openssl)安装openssl并正确链接brew link openssl后,应使用--with-brewed-openssl通过brew重新安装python./p>

I'm having some troubles while setting up my python env... I installed python over brew but when I try to install something with easy_install or pip I get this errors, in this example i tried to install an package with pip...

I'm using a Macbook with Mavericks, python 2.7.8...

Thank you! :)

$ sudo pip install test
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 356, in load_entry_point
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2439, in load_entry_point
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2155, in load
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/__init__.py", line 10, in <module>
    from pip.util import get_installed_distributions, get_prog
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 18, in <module>
    from pip._vendor.distlib import version
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/distlib/version.py", line 14, in <module>
    from .compat import string_types
  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/distlib/compat.py", line 31, in <module>
    from urllib2 import (Request, urlopen, URLError, HTTPError,
ImportError: cannot import name HTTPSHandler

brew list python

Joao-Carreira-Macbook-Pro:Desktop joaocarreira$ brew list python
/usr/local/Cellar/python/2.7.8/bin/2to3
/usr/local/Cellar/python/2.7.8/bin/2to3-2
/usr/local/Cellar/python/2.7.8/bin/2to3-2.7
/usr/local/Cellar/python/2.7.8/bin/easy_install
/usr/local/Cellar/python/2.7.8/bin/easy_install-2.7
/usr/local/Cellar/python/2.7.8/bin/idle
/usr/local/Cellar/python/2.7.8/bin/idle2
/usr/local/Cellar/python/2.7.8/bin/idle2.7
/usr/local/Cellar/python/2.7.8/bin/pip
/usr/local/Cellar/python/2.7.8/bin/pip2
/usr/local/Cellar/python/2.7.8/bin/pip2.7
/usr/local/Cellar/python/2.7.8/bin/pydoc
/usr/local/Cellar/python/2.7.8/bin/pydoc2
/usr/local/Cellar/python/2.7.8/bin/pydoc2.7
/usr/local/Cellar/python/2.7.8/bin/python
/usr/local/Cellar/python/2.7.8/bin/python-config
/usr/local/Cellar/python/2.7.8/bin/python2
/usr/local/Cellar/python/2.7.8/bin/python2-config
/usr/local/Cellar/python/2.7.8/bin/python2.7
/usr/local/Cellar/python/2.7.8/bin/python2.7-config
/usr/local/Cellar/python/2.7.8/bin/pythonw
/usr/local/Cellar/python/2.7.8/bin/pythonw2
/usr/local/Cellar/python/2.7.8/bin/pythonw2.7
/usr/local/Cellar/python/2.7.8/bin/smtpd.py
/usr/local/Cellar/python/2.7.8/bin/smtpd2.7.py
/usr/local/Cellar/python/2.7.8/bin/smtpd2.py
/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/ (3666 files)
/usr/local/Cellar/python/2.7.8/IDLE.app/Contents/ (8 files)
/usr/local/Cellar/python/2.7.8/libexec/pip/ (407 files)
/usr/local/Cellar/python/2.7.8/libexec/setuptools/ (252 files)
/usr/local/Cellar/python/2.7.8/Python Launcher.app/Contents/ (17 files)
/usr/local/Cellar/python/2.7.8/share/man/ (3 files)
/usr/local/Cellar/python/2.7.8/share/python/ (317 files)

brew install -vd python

Joao-Carreira-Macbook-Pro:Desktop joaocarreira$ brew install -vd python 
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/python.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/pkg-config.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/readline.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/sqlite.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/gdbm.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/openssl.rb
/usr/local/Library/brew.rb (Formulary::StandardLoader): loading /usr/local/Library/Formula/makedepend.rb
Warning: python-2.7.8 already installed, it's just not linked
解决方案

You should reinstall python via brew with --with-brewed-openssl after installing openssl with brew (brew install openssl) and correctly linking it brew link openssl.

这篇关于ImportError:无法使用Brew导入名称HTTPSHandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 05:31