如何使用Homebrew在Mac上默认设置Python3.8? [英] How to default Python3.8 on my Mac using Homebrew?

查看:736
本文介绍了如何使用Homebrew在Mac上默认设置Python3.8?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将python 3更新到最新版本3.8:

I have updated my python 3 to the latest version 3.8:

brew search python
==> Formulae
app-engine-python   gst-python          python ✔            python@3.8 ✔
boost-python        ipython             python-markdown     wxpython
boost-python3       micropython         python-yq

==> Casks
awips-python               kk7ds-python-runtime       mysql-connector-python

但是当我在Mac上检查python3版本时,它仍然显示3.7:

But when I check the python3 version on my mac it still shows 3.7:

python3 --version

Python 3.7.6

如何使用Homebrew将python3默认设置为最新的3.8版本?

how can I default python3 to the latest 3.8 version using Homebrew ?

当我尝试使用brew switch时,它告诉我我仅安装了python 3.7.6,但是在最后一个brew upgrade中,我很确定python3.8.1与Homebrew一起安装了

When I tried to use brew switch, it tells me I only installed python 3.7.6, but with last brew upgrade I'm pretty sure that python3.8.1 is installed with Homebrew

brew switch python 3.8.1
python does not have a version "3.8.1" in the Cellar.
python's installed versions: 3.7.6_1

推荐答案

好,感谢Homebrew社区讨论中的@gromgit(

Ok, thanks to @gromgit from Homebrew community discussion (https://discourse.brew.sh/t/how-to-default-python-3-8-on-my-mac-using-homebrew/7050)

这是解决方案:

$ brew info python@3.8
python@3.8: stable 3.8.1 (bottled) [keg-only]
...
==> Caveats
Python has been installed as
  /usr/local/opt/python@3.8/bin/python3
...
python@3.8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have python@3.8 first in your PATH run:
  echo 'export PATH="/usr/local/opt/python@3.8/bin:$PATH"' >> ~/.bash_profile

For compilers to find python@3.8 you may need to set:
  export LDFLAGS="-L/usr/local/opt/python@3.8/lib"

For pkg-config to find python@3.8 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig"

此时,我将坚持使用python(v3.7.6),并等待将来版本中v3.8.1的无缝升级.

I will stick to python (v3.7.6) at this time and wait for seamless upgrade of v3.8.1 in the future releases.

这篇关于如何使用Homebrew在Mac上默认设置Python3.8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆