【问题标题】:Issues installing python using pyenv on macOS M1在 macOS M1 上使用 pyenv 安装 python 的问题
【发布时间】:2023-04-04 10:35:01
【问题描述】:

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

➜  live_xr_cms_api git:(dev) ✗ pyenv install 3.9.6
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.6.tar.xz...
-> https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz
Installing Python-3.9.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 11.4 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/python-build.20210712183213.13974
Results logged to /var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/python-build.20210712183213.13974.log

Last 10 log lines:
                        $ensurepip --root=/ ; \
        fi
Looking in links: /var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/tmp85zin3_g
Processing /private/var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/tmp85zin3_g/setuptools-56.0.0-py3-none-any.whl
Processing /private/var/folders/b_/4pdsw1_15bx8l23n5wbblflc0000gn/T/tmp85zin3_g/pip-21.1.3-py3-none-any.whl
Installing collected packages: setuptools, pip
  WARNING: The scripts pip3 and pip3.9 are installed in '/Users/anzhari/.pyenv/versions/3.9.6/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  NOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications.
Successfully installed pip-21.1.3 setuptools-56.0.0

【问题讨论】:

  • 改用 Nix。
  • 也就是说,如果您真的很喜欢 pyenv,那么该问题的另一个答案会建议您使用 squademy.medium.com/…。不过,就我个人而言,我只能帮助 Nix 方法。
  • 我已经尝试让 pyenv 工作。最后改用 conda miniforge。
  • 如果您不再寻求答案,请考虑删除问题

标签:
python
zsh
macos-big-sur
pyenv