Mac M1安装python2教程

2024-09-08  本文已影响0人  yanmingfei

前言

node-sass依赖python2,然后在m1下系统已经默认不安装python2了,所以本文大概记录了一下安装流程。

步骤

  1. 安装 pyenv
brew install pyenv
  1. 通过pyenv安装python2
arch -x86_64 pyenv install 2.7.18

  1. 关联到本地:
# 写入bashrc文件中
export PATH="$(pyenv root)/shims:${PATH}"

遇到的问题:

  1. The Python ssl extension was not <xt-mark w="compile" style="opacity: 0.7 !important">compiled</xt-mark>. Missing the OpenSSL lib?

解决方法: <xt-mark w="brew" style="opacity: 0.7 !important">brew</xt-mark> uninstall --<xt-mark w="ignore" style="opacity: 0.7 !important">ignore</xt-mark>-dependencies openssl

  1. BUILD FAILED (OS X 12.3 using python-build 20180424)

解决方法:pyenv install 前面添加arch环境变量,参考步骤2。

参考资料:

  1. Install python@2 on Mac with M1 <xt-mark w="chip" style="opacity: 0.7 !important">chip</xt-mark>
  2. MacOS 用 pyenv 安装 Python 遇到 The Python ssl extension was not <xt-mark w="compile" style="opacity: 0.7 !important">compiled</xt-mark> 的解决方案

作者:微笑618
链接:https://juejin.cn/post/7088471072298762271
来源:稀土掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

上一篇下一篇

猜你喜欢

热点阅读