在 macOS M1 上使用 pyenv 安装 python 时出现问题

Anz*_*ari 1 python zsh pyenv macos-big-sur

我正在尝试使用 pyenv 准备多版本 python 开发环境。我已经成功安装了 pyenv。我通过 homebrew 安装了 pyenv ( https://github.com/pyenv/pyenv#homebrew-on-macos )。但是当我尝试安装 python 版本时,遇到了错误:

\n
\xe2\x9e\x9c  live_xr_cms_api git:(dev) \xe2\x9c\x97 pyenv install 3.9.6\npython-build: use openssl@1.1 from homebrew\npython-build: use readline from homebrew\nDownloading Python-3.9.6.tar.xz...\n-> https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz\nInstalling Python-3.9.6...\npython-build: use readline from homebrew\npython-build: use zlib from xcode sdk\nWARNING: The Python readline extension was not compiled. Missing the GNU readline lib?\nERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?\n\nPlease consult to the Wiki page to fix the problem.\nhttps://github.com/pyenv/pyenv/wiki/Common-build-problems\n\n\nBUILD FAILED (OS X 11.4 using python-build 20180424)\n\nInspect or clean up the working tree at /var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/python-build.20210712183213.13974\nResults logged to /var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/python-build.20210712183213.13974.log\n\nLast 10 log lines:\n                        $ensurepip --root=/ ; \\\n        fi\nLooking in links: /var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/tmp85zin3_g\nProcessing /private/var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/tmp85zin3_g/setuptools-56.0.0-py3-none-any.whl\nProcessing /private/var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/tmp85zin3_g/pip-21.1.3-py3-none-any.whl\nInstalling collected packages: setuptools, pip\n  WARNING: The scripts pip3 and pip3.9 are installed in \'/Users/anzhari/.pyenv/versions/3.9.6/bin\' which is not on PATH.\n  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.\n  NOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications.\nSuccessfully installed pip-21.1.3 setuptools-56.0.0\n
Run Code Online (Sandbox Code Playgroud)\n

小智 7

从 Rosetta 终端执行命令

pyenv 安装 [版本]