dougong2306 2019-04-20 02:54
浏览 296

邮差请求:ImportError:无法导入名称DEFAULT_CIPHERS

I'm using a Red Hat EC2 instance in order to run AWS CLI commands and manage some tasks with Glacier and S3. I'm also designing a Rest API in order to execute the scripts I've deployed on the EC2. Using Postman to send a POST request to the EC2's public DNS address, my script will take in a raw JSON and decode it for parameters my PHP script will take in. I run into an error when I try to execute the AWS CLI commands within my PHP script. The AWS commands work when I run them in the terminal.

Things I have tried from this thread

https://github.com/aws/aws-cli/issues/3542:

  • pip install AWScli instead of pip install AWS
  • downgrading AWSversions and Botocore

Postman Response

Traceback (most recent call last):
  File "/usr/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/lib/python2.7/site-packages/awscli/clidriver.py", line 17, in <module>
    import botocore.session
  File "/usr/lib/python2.7/site-packages/botocore/session.py", line 30, in <module>
    import botocore.credentials
  File "/usr/lib/python2.7/site-packages/botocore/credentials.py", line 42, in <module>
    from botocore.utils import InstanceMetadataFetcher, parse_key_val_file
  File "/usr/lib/python2.7/site-packages/botocore/utils.py", line 31, in <module>
    import botocore.httpsession
  File "/usr/lib/python2.7/site-packages/botocore/httpsession.py", line 7, in <module>
    from urllib3.util.ssl_ import (
ImportError: cannot import name DEFAULT_CIPHERS

Php Script

exec("aws s3 cp s3://$BucketName /path/to/dir/ --recursive 2>&1",$output,$return);

I expected the AWS CLI commands to be executed by the exec command and return a string output, which I would send back as a response.

  • 写回答

1条回答 默认 最新

  • drc4925 2019-04-21 01:04
    关注

    Fixed this problem by running this command

    sudo pip install awscli --force-reinstall --upgrade
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退