首页 > 解决方案 > Python SSL 模块在 Mac 上不可用?

问题描述

好的,我需要在我的 Mac 上安装 opencv 4,所以我按照https://www.pyimagesearch.com/2018/08/17/install-opencv-4-on-macos/cv安装了 opencv 并设置了虚拟环境.

我正在运行 Python 3.7.3。由于设置了这个,由于 SSL 问题,我无法安装任何软件包。尝试pip install spellworkon cv-

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

我已经尝试过 brew 卸载openssl和重新安装,以及其他 SO 解决方案,例如“Python 中的 ssl 模块不可用”,但是我在 macos 上而不是 linux 上。

如何安装 pip 包?

标签: pythonpython-3.xmacosopencvpip

解决方案


您的系统上可能同时拥有 Python2.7 和 Python3。尝试

pip --version

如果结果是这样的:

pip 19.3.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)

你的 pip 默认为 Python2

所以只是尝试

pip3 install spell

推荐阅读