【问题标题】:Mac with two Python version (2.7 and 3.9) but pointing to 2.7Mac 有两个 Python 版本(2.7 和 3.9)但指向 2.7
【发布时间】:2021-10-24 19:55:31
【问题描述】:

我正在尝试在我的 mac (Big Sur 11.5.2) 中安装 AWS cli (https://docs.aws.amazon.com/cli/latest/userguide/install-macos.html)。

当我尝试时,我得到一个错误,说 python 2.7 是旧的,我至少需要 python 3.6。 我发现我安装了两个 python 版本:

which python
=> /usr/bin/python

python -V
=> Python 2.7.16

which python3
=> /usr/local/bin/python3
 
python3 --version
=> Python 3.9.6

我有两个选择: 1-卸载python 2.7。但这似乎是个坏主意(How to uninstall Python 2.7 on a Mac OS X 10.6.4?) 2- 保留两个 python 版本,但是如何让 AWS 使用 python 3.9.6 而不是 python 2.7?

这些是安装 AWS cli (https://docs.aws.amazon.com/cli/latest/userguide/install-macos.html) 的命令:

curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

sudo 之后,就是这个错误:

Unsupported Python version detected: Python 2.7
To continue using this installer you must use Python 3.6 or later.

【问题讨论】:

  • 一个不会在 Mac 上“安装 AWS”。你到底想做什么?使用boto3?为什么不能使用python3 二进制?
  • 检查 PyE​​nv 以运行多个版本的 python。它可能已经安装,特别是如果 Python3 在 /usr/local
  • @OneCricketeer 我假设 OP 是指 AWS 命令​​行客户端和/或 SDK。
  • 使用“python3”代替“python”。除此之外,我认为您需要发布实际错误以及您具体在做什么。
  • @chepner 或者可以是 LocalStack(耸耸肩)

标签: python python-3.x amazon-web-services macos python-2.7


【解决方案1】:

谢谢大家的cmets。 我能够解决这个问题,我现在可以安装 AWS Cli。 我是使用aliaspip 完成的。

【讨论】:

  • 请在您的回答中提供更多详细信息。正如目前所写的那样,很难理解您的解决方案。
猜你喜欢
  • 2015-06-26
  • 1970-01-01
  • 1970-01-01
  • 2021-05-03
  • 1970-01-01
  • 1970-01-01
  • 2021-09-26
  • 1970-01-01
  • 2021-08-04
相关资源
最近更新 更多