“Python 中的 ssl 模块不可用";使用 pip3 安装包时 [英] "ssl module in Python is not available" when installing package with pip3

查看:42
本文介绍了“Python 中的 ssl 模块不可用";使用 pip3 安装包时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在本地计算机上成功安装 Python 3.4 和 Python 3.6,但无法使用 pip3 安装软件包.

I've install Python 3.4 and Python 3.6 on my local machine successfully, but am unable to install packages with pip3.

当我执行 pip3 install 时,我收到以下 SSL 相关 错误:

When I execute pip3 install <package>, I get the following SSL related error:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting <package>
  Could not fetch URL https://pypi.python.org/simple/<package>/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement <package> (from versions: )
No matching distribution found for <package>

如何修复我的 Python3.x 安装,以便我可以使用 pip install 安装包?

How can I fix my Python3.x install so that I can install packages with pip install <package>?

推荐答案

在 Ubuntu 中安装 Python 3.6 和 pip3 的分步指南

  1. 为 Python 和 ssl 安装必要的包:$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

下载并解压Python-3.6.8.tar.xz"从 https://www.python.org/ftp/python/ 进入您的主目录.

Download and unzip "Python-3.6.8.tar.xz" from https://www.python.org/ftp/python/ into your home directory.

在该目录中打开终端并运行:$ ./configure

Open terminal in that directory and run: $ ./configure

构建和安装:$ make &&须藤制作安装

安装包:$ pip3 install package_name

免责声明:以上命令未在 Ubuntu 20.04 LTS 中测试.

Disclaimer: The above commands are not tested in Ubuntu 20.04 LTS.

这篇关于“Python 中的 ssl 模块不可用";使用 pip3 安装包时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆