Windows环境下使用PIP安装pyTenable失败求助
解决Windows PowerShell中pip安装pyTenable及升级pip的SSL/403问题
一、临时绕过SSL证书验证(应急方案)
针对SSL证书验证失败的问题,可通过指定信任PyPI相关域名临时解决:
- 安装pyTenable:
pip install pyTenable --trusted-host pypi.org --trusted-host files.pythonhosted.org - 升级pip:
python -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
二、永久修复SSL证书问题(推荐)
若需长期解决证书验证问题,可选择以下两种方式:
- 追加CA证书到pip信任库
找到Python安装目录下的Lib\site-packages\pip\_vendor\certifi\cacert.pem文件,将本地机构/公司的根CA证书内容追加到该文件末尾,保存后重新执行pip命令。 - 设置PIP_CERT环境变量
- 临时生效(当前PowerShell会话):
$env:PIP_CERT = "C:\路径\到\你的\CA证书.pem" - 永久生效:右键「此电脑」→属性→高级系统设置→环境变量,添加系统变量
PIP_CERT,值为你的CA证书本地路径。
- 临时生效(当前PowerShell会话):
三、解决HTTP 403禁止访问问题
若SSL问题修复后出现403错误,可尝试以下方案:
- 配置代理(若处于公司/受限网络)
如果网络需通过代理访问外部资源,执行安装命令时指定代理:# 无认证代理 pip install pyTenable --proxy http://代理服务器地址:端口 # 带认证代理 pip install pyTenable --proxy http://用户名:密码@代理服务器地址:端口 - 切换国内PyPI镜像源
改用国内镜像源(如清华镜像)绕开网络限制:pip install pyTenable -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn # 升级pip也可使用镜像 python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
内容的提问来源于stack exchange,提问作者timothy
相关产品推荐
相关产品推荐

