s3cmd ImportError:没有名为S3.Exceptions的模块

时间:2021-05-17 14:06:58

Received an error after installing and trying to run s3cmd 1.0.0

安装并尝试运行s3cmd 1.0.0后收到错误

s3cmd -h

Problem: ImportError: No module named S3.Exceptions
S3cmd:   unknown version. Module import problem?

Traceback (most recent call last):
  File "/usr/bin/s3cmd", line 1995, in <module>
    from S3.Exceptions import *
ImportError: No module named S3.Exceptions

Your sys.path contains these entries:

This error came about after upgrading to the latest Amazon Linux distro 2015.03.0

升级到最新的Amazon Linux发行版2015.03.0后出现此错误

4 个解决方案

#1


19  

Looks like the error happened because python2.7 is now the default python version in the Amazon Linux 2015.03.0+ If you change python back to 2.6 and run s3cmd it should work without a problem

看起来错误发生是因为python2.7现在是Amazon Linux 2015.03.0+中的默认python版本如果你将python改回2.6并运行s3cmd它应该没有问题

update-alternatives --set python /usr/bin/python2.6
s3cmd -h

After the s3cmd command is ran you can put python back to 2.7 for yum and other utilities:

运行s3cmd命令后,您可以将python放回2.7以获取yum和其他实用程序:

update-alternatives --set python /usr/bin/python2.7
yum install <package>

#2


10  

vi /usr/bin/s3cmd

add 2.6 to the first line, so it looks like:

在第一行添加2.6,如下所示:

#!/usr/bin/python2.6

Save thefile and s3cmd will work. as long as you have /usr/bin/python2.6 on your system

保存文件和s3cmd将工作。只要你的系统上有/usr/bin/python2.6

#3


9  

I faced a similar error with s3cmd, but module name was different: ImportError: No module named S3.ExitCodes

我遇到了与s3cmd类似的错误,但模块名称不同:ImportError:没有名为S3.ExitCodes的模块

In my case I could solve the problem this way: yum install python-pip and then pip install s3cmd. After that s3cmd worked fine.

在我的情况下,我可以这样解决问题:yum install python-pip然后pip install s3cmd。之后s3cmd工作正常。

#4


0  

Neither of the previous answers worked for me, but copying a few lines from the sourcegraph aws-cli dockerfile did:

以前的答案都不适用于我,但是从sourcegraph aws-cli dockerfile复制了几行:

FROM python:2
RUN apt-get update -q
RUN apt-get install -qy python-pip groff-base
RUN pip install awscli

从python:2运行apt-get update -q RUN apt-get install -qy python-pip groff-base RUN pip install awscli

#1


19  

Looks like the error happened because python2.7 is now the default python version in the Amazon Linux 2015.03.0+ If you change python back to 2.6 and run s3cmd it should work without a problem

看起来错误发生是因为python2.7现在是Amazon Linux 2015.03.0+中的默认python版本如果你将python改回2.6并运行s3cmd它应该没有问题

update-alternatives --set python /usr/bin/python2.6
s3cmd -h

After the s3cmd command is ran you can put python back to 2.7 for yum and other utilities:

运行s3cmd命令后,您可以将python放回2.7以获取yum和其他实用程序:

update-alternatives --set python /usr/bin/python2.7
yum install <package>

#2


10  

vi /usr/bin/s3cmd

add 2.6 to the first line, so it looks like:

在第一行添加2.6,如下所示:

#!/usr/bin/python2.6

Save thefile and s3cmd will work. as long as you have /usr/bin/python2.6 on your system

保存文件和s3cmd将工作。只要你的系统上有/usr/bin/python2.6

#3


9  

I faced a similar error with s3cmd, but module name was different: ImportError: No module named S3.ExitCodes

我遇到了与s3cmd类似的错误,但模块名称不同:ImportError:没有名为S3.ExitCodes的模块

In my case I could solve the problem this way: yum install python-pip and then pip install s3cmd. After that s3cmd worked fine.

在我的情况下,我可以这样解决问题:yum install python-pip然后pip install s3cmd。之后s3cmd工作正常。

#4


0  

Neither of the previous answers worked for me, but copying a few lines from the sourcegraph aws-cli dockerfile did:

以前的答案都不适用于我,但是从sourcegraph aws-cli dockerfile复制了几行:

FROM python:2
RUN apt-get update -q
RUN apt-get install -qy python-pip groff-base
RUN pip install awscli

从python:2运行apt-get update -q RUN apt-get install -qy python-pip groff-base RUN pip install awscli