长话短说,我想在带有M1芯片组的MacBook Pro上安装Apache Cassandra。
为了安装它,必须先安装其他软件,其中一个是python,必须更新到最新版本。
当询问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.
有什么办法可以解决这个问题吗?
我可以在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
有时你会得到一些错误,比如缺少一些东西如果你正在使用Rosetta,那么运行:
arch -arm64 pyenv install 2.7.18
对于asdf
版本管理器用户,可以安装python插件。
asdf plugin add python
然后你可以通过调用
来安装python2asdf install python 2.7.18
# Then you can declare the local python
asdf local python 2.7.18