SSL 模块不可用,为 python 安装 pyodbc 时出错

问题描述 投票:0回答:1

我必须导入

pyodbc
库,为此我已经执行了

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pyodbc

并且收到以下错误:

ERROR: Could not find a version that satisfies the requirement pyodbc (from versions: none)
ERROR: No matching distribution found for pyodbc
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

screenshot of the error

我的pip版本是:pip 24.0和python版本:Python 3.7.1 (我使用的是Windows 10)

我尝试重新安装Python并检查“将python.exe添加到路径”,但没有帮助。我应该注意到,过去我使用旧版本的 Python 并且没有收到此错误。

python ssl pip pycharm pyodbc
1个回答
0
投票

首先,如果您还没有使用,您应该考虑使用 Python 虚拟环境

然后在你的Windows机器上安装pyodbc:

先尝试

pip install pyodbc
。这在绝大多数情况下应该“有效”。 pip 将为您的 PC/Python 设置下载正确的 pyodbc 轮并安装它。 如果出于某种原因您需要从源代码构建 pyodbc — 例如,如果
pip install pyodbc
下载像“pyodbc-4.0.35.tar.gz”这样的源代码发行版而不是预构建的轮子 (.whl) 文件 — 那么请确保您的 PC 上有适当的 C++ 编译器。有关详细信息,请参阅此处

© www.soinside.com 2019 - 2024. All rights reserved.