英文:
How to resolve openssl not found error while installing new Python version with Pyenv on M1 Mac OS Ventura 13.1?
问题
系统使用的是MacOS Ventura 13.1上的M1处理器。在使用pyenv
安装新版本时,出现了关于系统上找不到openssl
的错误。openssl
已经安装,版本号是LibreSSL 3.3.6
。
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'readline'
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/divyesh.parmar@postman.com/.pyenv/versions/3.10.6/lib/python3.10/ssl.py", line 99, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
我已经尝试了这个帖子中提到的方法,但似乎都没有效果。如何解决这个问题?
英文:
The system is M1 processor on MacOS Ventura 13.1. While installing a new version with pyenv
, it throws following error regarding openssl
not found on the system. openssl
is already installed with the version number LibreSSL 3.3.6
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'readline'
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/divyesh.parmar@postman.com/.pyenv/versions/3.10.6/lib/python3.10/ssl.py", line 99, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
I've mostly tried approaches mentioned on this thread, but none of that seems to lead to anywhere. How to resolve this?
答案1
得分: 1
在查看了Pyenv
项目的多个Github主题后,其中一种最简单的方法奏效。
# 提供一个错误的openssl版本,强制下载并在构建过程中链接正确的openssl版本
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA=openssl@1.0
设置了这个之后,运行安装任何版本的命令时,将自动下载和链接所需版本的openssl
。
参考链接:https://github.com/pyenv/pyenv/issues/1768#issuecomment-1423144852
英文:
After looking at several Github threads on Pyenv
project, one of the simplest method worked like a charm.
# Providing an incorrect openssl version forces a proper openssl version to be downloaded and linked during the build
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA=openssl@1.0
After setting this, upon running the command to install any version, it will automatically download and link the required version of openssl
Reference : https://github.com/pyenv/pyenv/issues/1768#issuecomment-1423144852
答案2
得分: 0
你可以使用更高版本的openssl,方法如下:
export CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)"
英文:
You can use a higher version of openssl with :
export CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论