global name 'ssl' is not defined error while executing aws s3 cp command

丶灬走出姿态 提交于 2020-07-09 06:41:22

问题


Am trying to upload a file to the AWS S3 using the AWS CLI command. I am using a system with RedHat 4 operating system. Python version is 2.7.9 OpenSSL version is 0.9.8v 19 Apr 2012.

I have installed the AWS CLI and when I executed the below command I got an error regarding the ssl

[test-user@redhat4 ~]$ aws s3 cp /export/home/test_dir/test_file.txt s3://test-bucket/ --region us-west-2

upload failed: test_file.txt to s3://test-bucket/test_file.txt global name 'ssl' is not defined

Does I have to configure anything regarding the Openssl. Could anyone please help me to resolve this issue as am blocked with this issue for the last few days.


回答1:


I've solved this problem by installing Python again with SSL support. I did it on old CentOS 5.1 server - but it will be the same for any other Linux distro. Also, you need Python 2.7.12 at least.

The example is for installing it in opt folder - you can change it. Thanks to sergey for the answer.

# install openssl-devel
yum -y install openssl-devel

# re-install python
cd /opt/Python-2.7.13
./configure --with-ssl  ### this line is the key 

make

make install

# re-install AWS 
cd /opt

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

# you can make sure that python was installed with ssl support
# by running this command without error or messages.
python2.7 -c "import ssl"


来源:https://stackoverflow.com/questions/43121166/global-name-ssl-is-not-defined-error-while-executing-aws-s3-cp-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!