简体   繁体   English

使用 pip (macOS) 安装 awscli 时出错

[英]Error installing awscli using pip (macOS)

I'm trying to install Amazon's awscli onto my mac, and I am running into a few errors that I'm not able to diagnose.我正在尝试将 Amazon 的 awscli 安装到我的 Mac 上,但遇到了一些我无法诊断的错误。 I've followed all the steps so far in this link , but when I actually try to install awscli, it gives me the following error:到目前为止,我已按照此链接中的所有步骤进行操作,但是当我实际尝试安装 awscli 时,出现以下错误:

  Could not find a version that satisfies the requirement awscli (from versions: )
No matching distribution found for awscli

The full trace of what is happening is正在发生的事情的完整痕迹是

bash-3.2$ ./Library/Python/2.7/bin/pip install awscli --upgrade --user
Collecting awscli
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b0d4390>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)': /simple/awscli/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b0d4890>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)': /simple/awscli/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b0d4d10>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)': /simple/awscli/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b0d4d50>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)': /simple/awscli/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b0d4690>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)': /simple/awscli/
 Could not find a version that satisfies the requirement awscli (from versions: )
No matching distribution found for awscli

I'm almost 100% sure that there is a connection error to the resource I am trying to install, but since the command comes directly from Amazon, it shouldn't be outdated?我几乎 100% 确定我尝试安装的资源存在连接错误,但由于该命令直接来自 Amazon,所以它应该不会过时吗? Also, I am running pip version 9.0.1, so there shouldn't be an out of date issue.另外,我正在运行 pip 版本 9.0.1,所以不应该有过时的问题。

This worked for me.这对我有用。 Hope this helps other people who encounter this issue.希望这可以帮助遇到此问题的其他人。

brew install python3    
pip3 install awscli --upgrade --user

You should be able to follow the other set of instructions there:您应该能够按照那里的另一组说明进行操作:

https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html

Install the AWS CLI Using the Bundled Installer使用捆绑安装程序安装 AWS CLI

Follow these steps from the command line to install the AWS CLI using the bundled installer.按照命令行中的这些步骤使用捆绑安装程序安装 AWS CLI。

To install the AWS CLI using the bundled installer使用捆绑安装程序安装 AWS CLI

Download the AWS CLI Bundled Installer.下载 AWS CLI 捆绑安装程序。

 $ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

Unzip the package.解压缩包。

 $ unzip awscli-bundle.zip

Note注意

If you don't have unzip, use your Linux distribution's built in package manager to install it.如果您没有解压缩,请使用您的 Linux 发行版的内置包管理器来安装它。

Run the install executable.运行安装可执行文件。

 $ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

Note注意

By default, the install script runs under the system default version of Python.默认情况下,安装脚本在 Python 的系统默认版本下运行。 If you have installed an alternative version of Python and want to use that to install the AWS CLI, run the install script with that version by absolute path to the Python executable.如果您已经安装了 Python 的替代版本并希望使用它来安装 AWS CLI,请通过 Python 可执行文件的绝对路径使用该版本运行安装脚本。 For example:例如:

 $ sudo /usr/local/bin/python2.7 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

The installer installs the AWS CLI at /usr/local/aws and creates the symlink aws at the /usr/local/bin directory.安装程序将 AWS CLI 安装在 /usr/local/aws 并在 /usr/local/bin 目录中创建符号链接 aws。 Using the -b option to create a symlink eliminates the need to specify the install directory in the user's $PATH variable.使用 -b 选项创建符号链接无需在用户的 $PATH 变量中指定安装目录。 This should enable all users to call the AWS CLI by typing aws from any directory.这应该允许所有用户通过从任何目录键入 aws 来调用 AWS CLI。

To see an explanation of the -i and -b options, use the -h option:要查看 -i 和 -b 选项的说明,请使用 -h 选项:

 $ ./awscli-bundle/install -h

I have found the easiest way is to just install it with conda ;我发现最简单的方法是使用conda安装它;

https://anaconda.org/conda-forge/awscli https://anaconda.org/conda-forge/awscli

You can use some commands like this:你可以使用一些这样的命令:

$ wget "https://repo.continuum.io/miniconda/Miniconda3-4.5.4-MacOSX-x86_64.sh"
$ bash "Miniconda3-4.5.4-MacOSX-x86_64.sh" -b -p "${PWD}/conda"
$ source "${PWD}/conda/bin/activate"
(base) $ conda config --add channels conda-forge
(base) $ conda install -y -c conda-forge awscli=1.16.29
(base) $ aws --version
aws-cli/1.16.29 Python/3.6.5 Darwin/16.7.0 botocore/1.12.19

The caveat is that you will need to use this conda installation whenever you need to use the AWS CLI, but its easier than messing with system-wide installations or pip configs, IMO, and conda is more robust than a Python virtual env.需要注意的是,无论何时需要使用 AWS CLI,您都需要使用此conda安装,但它比搞乱系统范围的安装或 pip 配置更容易,IMO 和conda比 Python 虚拟环境更强大。

Facing similar error while installing awscli on my mac machine(Mojave version).在我的 mac 机器(Mojave 版本)上安装 awscli 时遇到类似的错误。 Followed below steps to resolve it.按照以下步骤解决它。

  1. Try to install awscli using brew.尝试使用 brew 安装 awscli。

     brew install awscli
  2. Reference link :参考链接:

    https://vyspiansky.github.io/2018/03/17/install-aws-cli-on-macos/ https://vyspiansky.github.io/2018/03/17/install-aws-cli-on-macos/

    This link helped me.这个链接帮助了我。 Hope this helps!!.希望这有帮助!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM