【树莓派】报错 pip is configured with locations that require TLS/SSL(2021年12月31日已解决)

报错信息

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.python.org/simple/opencv-python/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping

系统

树莓派 3b
安装完系统后树莓派自带的是 python3.9
但是由于开发需要安装 python3.6

下载了 python3.6.8 源代码后编译安装
运行

curl https://bootstrap.pypa.io/get-pip.py | python

发生了前面提到的报错,是 openssl 的问题,使用命令查看了一下,系统中是有 openssl 的,而且也是最新版本,所以问题应该还是 python3.6 的安装引起的。
所以网上提到的重装 openssl 是无效的

解决方案

  1. 第一步安装需要的依赖文件
sudo apt-get install build-essential checkinstall 
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
  1. 第二步重新到 python3.6.8 的源代码文件夹内,编译安装 python3.6.8

然后问题就解决了!

你可能感兴趣的:(树莓派,ssl,python,网络协议)