如何检查awscli和兼容的botocore软件包已安装

时间:2018-08-18 17:29:33

标签: amazon-s3 amazon-ec2 pip botocore

我正在尝试使用boto3为aws学习python,所以我正在尝试执行此处提供的代码https://boto3.readthedocs.io/en/latest/guide/s3-example-creating-buckets.html 我遇到了错误module boto3 not found
所以我根据这里的答案升级到boto3 Unable to install boto3  被提及使用pip3 install boto3 发出此命令给我以下输出

C:\Users\DEEL>pip3 install boto3
Collecting boto3
  Downloading https://files.pythonhosted.org/packages/c9/cd/d48602dc99ecb52876cf
741477f15c874b631e5776723f27092693a5b535/boto3-1.7.80-py2.py3-none-any.whl (128k
B)
    100% |████████████████████████████████| 133kB 160kB/s
Collecting botocore<1.11.0,>=1.10.80 (from boto3)
  Downloading https://files.pythonhosted.org/packages/5e/cf/b97f44993766af17bf64
aeddadf66f63b6ebf3d700565cc7ee7b13cd0067/botocore-1.10.80-py2.py3-none-any.whl (
4.5MB)
    100% |████████████████████████████████| 4.5MB 1.3MB/s
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in e:\installation2\python
3\lib\site-packages (from boto3) (0.9.3)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in e:\installation2\pyt
hon3\lib\site-packages (from boto3) (0.1.13)
Requirement already satisfied: docutils>=0.10 in e:\installation2\python3\lib\si
te-packages (from botocore<1.11.0,>=1.10.80->boto3) (0.14)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1; python_version >= "2
.7" in e:\installation2\python3\lib\site-packages (from botocore<1.11.0,>=1.10.8
0->boto3) (2.7.3)
Requirement already satisfied: six>=1.5 in e:\installation2\python3\lib\site-pac
kages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore<1.11.
0,>=1.10.80->boto3) (1.11.0)
awscli 1.15.80 has requirement botocore==1.10.79, but you'll have botocore 1.10.
80 which is incompatible.
Installing collected packages: botocore, boto3
  Found existing installation: botocore 1.10.79
    Uninstalling botocore-1.10.79:
      Successfully uninstalled botocore-1.10.79

在此输出中有一行 awscli 1.15.80 has requirement botocore==1.10.79, but you'll have botocore 1.10. 80 which is incompatible.

所以根据这里的链接 How to upgrade AWS CLI to the latest version?我升级了awscli pip3 install –upgrade awscli 屏幕上显示以下输出

C:\Users\DEEL>pip3 install --upgrade awscli
Collecting awscli
  Downloading https://files.pythonhosted.org/packages/6b/fa/89c248eaacccd816fdea
88206060a7cd221f227855782ff7b0ffb80d725a/awscli-1.15.81-py2.py3-none-any.whl (1.
3MB)
    100% |████████████████████████████████| 1.3MB 198kB/s
Requirement already satisfied, skipping upgrade: rsa<=3.5.0,>=3.1.2 in e:\instal
lation2\python3\lib\site-packages (from awscli) (3.4.2)
Requirement already satisfied, skipping upgrade: PyYAML<=3.13,>=3.10 in e:\insta
llation2\python3\lib\site-packages (from awscli) (3.13)
Requirement already satisfied, skipping upgrade: colorama<=0.3.9,>=0.2.5 in e:\i
nstallation2\python3\lib\site-packages (from awscli) (0.3.9)
Requirement already satisfied, skipping upgrade: botocore==1.10.80 in e:\install
ation2\python3\lib\site-packages (from awscli) (1.10.80)
Requirement already satisfied, skipping upgrade: s3transfer<0.2.0,>=0.1.12 in e:
\installation2\python3\lib\site-packages (from awscli) (0.1.13)
Requirement already satisfied, skipping upgrade: docutils>=0.10 in e:\installati
on2\python3\lib\site-packages (from awscli) (0.14)
Requirement already satisfied, skipping upgrade: pyasn1>=0.1.3 in e:\installatio
n2\python3\lib\site-packages (from rsa<=3.5.0,>=3.1.2->awscli) (0.4.4)
Requirement already satisfied, skipping upgrade: jmespath<1.0.0,>=0.7.1 in e:\in
stallation2\python3\lib\site-packages (from botocore==1.10.80->awscli) (0.9.3)
Requirement already satisfied, skipping upgrade: python-dateutil<3.0.0,>=2.1; py
thon_version >= "2.7" in e:\installation2\python3\lib\site-packages (from botoco
re==1.10.80->awscli) (2.7.3)
Requirement already satisfied, skipping upgrade: six>=1.5 in e:\installation2\py
thon3\lib\site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.
7"->botocore==1.10.80->awscli) (1.11.0)
Installing collected packages: awscli
  Found existing installation: awscli 1.15.80
    Uninstalling awscli-1.15.80:
      Successfully uninstalled awscli-1.15.80
Successfully installed awscli-1.15.81

我的问题是什么,我在安装boto3时收到了什么不兼容消息?awscli 1.15.80 has requirement botocore==1.10.79, but you'll have botocore 1.10. 80 which is incompatible.我如何检查awscli和botocore安装的兼容性以及我应该怎么做?机器,这样我就不会在进一步的开发工作中遇到问题。

pip3列表显示以下

C:\Users\DEEL>pip3 list
Package         Version
--------------- -------
awscli          1.15.81
boto3           1.7.80
botocore        1.10.80
colorama        0.3.9
docutils        0.14
jmespath        0.9.3
pip             18.0
pyasn1          0.4.4
python-dateutil 2.7.3
PyYAML          3.13
rsa             3.4.2
s3transfer      0.1.13
setuptools      39.0.1
six             1.11.0

我现在应该怎么做才能使awscli和botocore兼容?

但是我想提一提我在https://boto3.readthedocs.io/en/latest/guide/s3-example-creating-buckets.html中尝试执行的代码在所有这些工作之后都成功执行了。

2 个答案:

答案 0 :(得分:3)

下面显示了相同的问题以及如何解决。

将aws-cli升级到最新版本

$ pip3 install awscli --upgrade --user

卸载现有的先前版本的botocore和boto3

$ pip3 uninstall botocore
$ pip3 uninstall boto3

然后重新安装

$ pip3 install botocore
$ pip3 install boto3

结果日志

Package         Version
--------------- -------
awscli          1.16.1 
boto3           1.8.1  
botocore        1.11.1 
colorama        0.3.9  
docutils        0.14   
jmespath        0.9.3  
pip             18.0   
pyasn1          0.4.4  
python-dateutil 2.7.3  
PyYAML          3.13   
rsa             3.4.2  
s3transfer      0.1.13 
setuptools      40.0.0 
six             1.11.0 
urllib3         1.23   
virtualenv      16.0.0 
wheel           0.31.1

答案 1 :(得分:0)

其他答案强调升级版本,但如果有人需要使用特定版本,则存在问题。我必须使用需要 botocore 1.18.18 的第三方库,并且我想要相应的 awscli 兼容版本。为此,只需访问 release history page of botocore on pypi 。搜索您的 botocore 版本并检查其发布日期。之后,访问相应的release history page of awscli 并搜索在该特定日期发布的 awscli 版本。