Use
pip install pyopenssl==0.12.0
when you got such exception on Centos 5.9:
$ pip install pyopenssl
Downloading/unpacking pyopenssl
Downloading pyOpenSSL-0.13.1.tar.gz (254kB): 254kB downloaded
Running setup.py egg_info for package pyopenssl
warning: no previously-included files matching '*.pyc' found anywhere in distribution
Installing collected packages: pyopenssl
Running setup.py install for pyopenssl
building 'OpenSSL.crypto' extension
...........
gcc -pthread -shared build/temp.linux-x86_64-2.6/OpenSSL/rand/rand.o build/temp.linux-x86_64-2.6/OpenSSL/util.o -L/usr/lib64 -lssl -lcrypto -lpython2.6 -o build/lib.linux-x86_64-2.6/OpenSSL/rand.so
building 'OpenSSL.SSL' extension
creating build/temp.linux-x86_64-2.6/OpenSSL/ssl
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c OpenSSL/ssl/connection.c -o build/temp.linux-x86_64-2.6/OpenSSL/ssl/connection.o
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_context’:
OpenSSL/ssl/connection.c:289: warning: implicit declaration of function ‘SSL_set_SSL_CTX’
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_get_servername’:
OpenSSL/ssl/connection.c:313: error: ‘TLSEXT_NAMETYPE_host_name’ undeclared (first use in this function)
OpenSSL/ssl/connection.c:313: error: (Each undeclared identifier is reported only once
OpenSSL/ssl/connection.c:313: error: for each function it appears in.)
OpenSSL/ssl/connection.c:320: warning: implicit declaration of function ‘SSL_get_servername’
OpenSSL/ssl/connection.c:320: warning: assignment makes pointer from integer without a cast
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_tlsext_host_name’:
OpenSSL/ssl/connection.c:346: warning: implicit declaration of function ‘SSL_set_tlsext_host_name’
error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /home/.../app/bin/python2.6 -c "import setuptools;__file__='/home/.../app/build/pyopenssl/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vBzwJt-record/install-record.txt --single-version-externally-managed --install-headers /home/.../app/include/site/python2.6 failed with error code 1 in /home/.../app/build/pyopenssl
Traceback (most recent call last):
File "/home/.../app/bin/pip", line 8, in <module>
load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
File "/home/.../app/lib/python2.6/site-packages/pip/__init__.py", line 148, in main
return command.main(args[1:], options)
File "/home/.../app/lib/python2.6/site-packages/pip/basecommand.py", line 169, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)