【问题标题】:Install python@2 on Mac with M1 chip使用M1芯片在Mac上安装python@2
【发布时间】:2021-08-26 09:25:17
【问题描述】:

长话短说,我想在配备 M1 芯片组的 MacBook Pro 上安装 Apache Cassandra。

要安装它,必须先安装其他软件,其中之一是python,必须更新到最新版本。我关注了this tutorial

这是询问 python 现有版本时终端显示的内容:

> python --version 
Python 2.7.16

在教程中,他们将其更新到 2.7.17,所以我尝试这样做:

> brew install python@2

这是输出:

Warning: No available formula or cask with the name "python@2". Did you mean bpython, ipython, jython or cython?
==> Searching for similarly named formulae...
These similarly named formulae were found:
bpython             ipython             jython              cython
To install one of them, run (for example):
  brew install bpython
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

任何想法如何克服这个问题?

【问题讨论】:

  • 您安装的是哪个版本的 Cassandra?如果是 4,那么它支持 Python 3 开箱即用
  • 看起来内置 M1 的 MacBook Pro 现在自带 Python 2.7.18

标签: python macos python-2.7 cassandra apple-m1


【解决方案1】:

我可以在 M1 上安装 2.7.18。

brew install pyenv
pyenv install 2.7.18

必要时导出 PATH。

export PATH="$(pyenv root)/shims:${PATH}"

必要时添加。

echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc

【讨论】:

  • 太好了,谢谢!为我工作。
  • arch -arm64 brew install pyenv
【解决方案2】:

我遇到了同样的问题。 Homebrew 不再安装 Python2,因为它的生命周期即将结束,并且将不再获得支持。试试这个对我有用。

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | python

然后你运行:

 sudo easy_install pip

它会在您输入您的管理员密码,然后您可以检查它是否正常运行

pip --version 

【讨论】:

  • 这行得通吗? easy_install 已弃用
  • 这里下载的是 pip,不是 python2
猜你喜欢
  • 2021-04-26
  • 1970-01-01
  • 2022-09-25
  • 2022-07-01
  • 1970-01-01
  • 2021-07-09
  • 1970-01-01
  • 2022-08-10
  • 2022-08-18
相关资源
最近更新 更多