安装python@2在带有M1芯片的Mac上

mspsb9vt  于 2022-09-27  发布在  Python
关注(0)|答案(2)|浏览(304)

长话短说,我想在带有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.

有什么想法可以克服这个问题吗?

pgccezyw

pgccezyw1#

我可以在M1上安装2.7.18。

brew install pyenv
pyenv install 2.7.18

设置python版本。

pyenv global 2.7.18

如有必要,导出PATH。

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

必要时添加

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

n1bvdmb62#

有时,如果使用rosetta,然后运行arch -arm64 pyenv install 2.7.18,会出现一些错误,例如缺少某些内容

相关问题