gpt4 book ai didi

python - 为什么安装 boto3 会破坏我的 awscli 安装?

转载 作者:行者123 更新时间:2023-12-04 18:25:22 26 4
gpt4 key购买 nike

我正在尝试安装 boto3,以便可以在我想在运行 Ubuntu 14.04 的 EC2 实例上运行的 python 脚本中使用它。无论如何,我安装 boto3 它会破坏我在非 root 用户上安装 awscli。我使用 apt get 和 sudo apt-get install awscli 安装 awscli .安装后,它适用于 root 用户和 ubuntu 用户。

ubuntu@ip-10-12-10-8:~$ aws --version
aws-cli/1.14.65 Python/2.7.6 Linux/3.13.0-143-generic botocore/1.9.18
ubuntu@ip-10-12-10-8:~$ sudo aws --version
aws-cli/1.14.65 Python/2.7.6 Linux/3.13.0-143-generic botocore/1.9.18

我也尝试过安装 awscli 就像 AWS 建议的 sudo pip install awscli --upgrade --user .此外,如果这意味着任何 pip 仅以 root 用户身份运行,则可能安装错误。

这是我用 pip 安装 boto3 时的输出。

但是,每当我使用 pip 安装 boto3 时,它都会为 ubuntu 用户破坏它。我尝试安装 boto3,然后以多种不同的方式安装 awscli,但没有任何效果。以下是我尝试过的方法。
ubuntu@ip-10-12-10-8:~$ sudo pip install boto3
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting boto3
/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:339:
SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:137:
InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Downloading boto3-1.7.4-py2.py3-none-any.whl (128kB)
100% |████████████████████████████████| 133kB 6.9MB/s
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in
/usr/local/lib/python2.7/dist-packages (from boto3)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in
/usr/local/lib/python2.7/dist-packages (from boto3)
Collecting botocore<1.11.0,>=1.10.4 (from boto3)
Downloading botocore-1.10.4-py2.py3-none-any.whl (4.2MB)
100% |████████████████████████████████| 4.2MB 328kB/s
Requirement already satisfied: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /usr/local/lib/python2.7/dist-packages (from s3transfer<0.2.0,>=0.1.10->boto3)
Requirement already satisfied: python-dateutil<2.7.0,>=2.1 in
/usr/local/lib/python2.7/dist-packages (from botocore<1.11.0,>=1.10.4->boto3)
Requirement already satisfied: docutils>=0.10 in /usr/local/lib/python2.7/dist-packages (from botocore<1.11.0,>=1.10.4->boto3)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python2.7/dist-packages (from python-dateutil<2.7.0,>=2.1->botocore<1.11.0,>=1.10.4->boto3)
Installing collected packages: botocore, boto3
Found existing installation: botocore 1.9.18
Uninstalling botocore-1.9.18:
Successfully uninstalled botocore-1.9.18
Successfully installed boto3-1.7.4 botocore-1.10.4

这就是结果。我需要 aws 工具来像安装 boto3 之前那样对两个用户都工作。
ubuntu@ip-10-12-10-8:~$ aws --version
Traceback (most recent call last):
File "/usr/local/bin/aws", line 19, in <module>
import awscli.clidriver
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 17, in <module>
import botocore.session
ImportError: No module named botocore.session
ubuntu@ip-10-12-10-8:~$ sudo aws --version
aws-cli/1.14.65 Python/2.7.6 Linux/3.13.0-143-generic botocore/1.10.

到底是怎么回事?我一直在这。

最佳答案

这就是我使用的,它还将安装 awscli 和具有自动完成功能的 aws-shell。

$ sudo pip install aws-shell --upgrade --ignore-installed six

让我知道这是否修复了 boto3 和 awscli。

关于python - 为什么安装 boto3 会破坏我的 awscli 安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49767264/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com