在 VMWare 虚拟机上使用 Ubuntu 18.04 LTS。
我正在尝试设置本地 python 2.7.12 环境,make
以便为正在开发的应用程序创建虚拟环境。但是,由于某种原因,当我pip
通过 pythonensurepip
命令进行安装时,遇到了错误:Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS
以下是我在终端中采取的步骤:
# Install necessary packages
#
sudo apt-get update
sudo apt-get install curl make g++ \
zip zlibc zlib1g zlib1g-dev \
bzip2 libbz2-dev \
libncurses5-dev libreadline6-dev ncurses-doc \
libssl-dev \
uuid-dev \
sqlite3 libsqlite3-dev \
libapr1 libapr1-dev libaprutil1 libaprutil1-dev \
libxml2-dev libxslt1-dev \
haproxy
# Configure environment
#
WW_PREFIX=~/company/application
export WW_PREFIX
# Update PATH (.profile)
#
PATH="${WW_PREFIX}/bin:${PATH}"
export PATH
# Python
#
curl -O "https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz"
tar xvfz Python-2.7.12.tgz
cd Python-2.7.12
./configure "--prefix=${WW_PREFIX}" --with-threads --with-ssl --with-zlib
sudo make
sudo make install
cd ..
rm -rf Python-2.7.12
rm Python-2.7.12.tgz
# Test that it works
#
"${WW_PREFIX}/bin/python" -V
下一步是调用这个:
sudo -H "${WW_PREFIX}/bin/python" -m ensurepip
sudo -H "${WW_PREFIX}/bin/pip" install --upgrade pip
但是当我到达该ensurepip
行时,我得到了错误
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
File "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 97, 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 "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 97, 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 "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 97, 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 "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 97, 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 "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 97, 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 "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/user/webworks/clouddrafts/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS
我到处都尝试解决这个问题。许多其他解决方案都建议libssl-dev
需要安装才能解决此特定错误,但我已经安装了它,如我的apt-get
列表中所示。我也尝试过该get-pip.py
方法,但失败了。我想说的是,对于这些尝试,都找不到 SSL 库,但我不知道我做错了什么。
答案1
为了解决这个问题,我需要正确安装openssl-dev
。对于 Ubuntu 18.04 和我的情况,通过安装libssl1.0-dev
而不是解决了这个问题libssl-dev
。
sudo apt-get install libssl1.0-dev