pip 安装出错 ,无法安装python包,ssl module in Python is not avaiable等问题解决,非https源等

方法一,安装openssl 最新版可彻底解决

可以直接下载新版的 openssl 安装,但建议用windows下的包管理器choco 安装,步骤如下:

  1. 确认已经安装有windows dotNet Framework 4.5+

例如安装 .NET Framework 4.8 的 Runtime库:
https://dotnet.microsoft.com/download/dotnet-framework/net48这里是引用

  1. 确认已安装有 windows powershell 5.1

微软官方安装网址:
https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/wmf/setup/install-configure?view=powershell-7.1
安装后CMD运行powershell.exe,然后 输入以下代码查看版本号。

$PSVersionTable.PSVersion
  1. 安装Win下包管理器 choco

推荐方法是利用 chocolatey 的安装脚本 https://chocolatey.org/install.ps1
管理员权限下运行 powershell.exe, 执行以下代码即可

Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  1. choco 安装好了,就可以方便的直接安装常用工具,如安装 openssl
choco install openssl

一般安装openssl 后, pip 无法使用ssl协议的问题就可解决。


方法二,使用非https协议的源

如国内的源

http://pypi.douban.com/simple/ 豆瓣
http://mirrors.aliyun.com/pypi/simple/ 阿里
http://pypi.hustunique.com/simple/ 华中理工大学
http://pypi.sdutlinux.org/simple/ 山东理工大学
http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学

使用示例:

  • 如用豆瓣的源安装 百度的库 baidu-aip
pip install baidu-aip -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
  • 如用豆瓣的源安装 拼音模块 pinyin
pip install pinyin -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值