from urllib3.util.ssl_ import (ImportError: cannot import name ssl

oha*_*hay 7 python python-2.7

我的资源:

Python 2.7、Ubunutu 18.04、Pycharm、虚拟框oracle

我有一个用 python 构建的自动化解决方案。该解决方案可以从两个运行cmdpycharm当然。2 个运行自动化解决方案的选项。

python main.py args a,b,c...(run 1 suite of tests)
python jenkinsRun.py arg a,b,c...(run main.py with diff args each time -lets say 5 time for instance)
Run Code Online (Sandbox Code Playgroud)

一旦jenkinsRun.py运行,它将main.py像这样执行每个:

os.system('python main.py %s %s %s %s %s %s'%(STD,config.VpcStackName, '-dryrun', 'false', '-tenant' ,config.PROD_STAGE_Tenant))
Run Code Online (Sandbox Code Playgroud)

请注意,这是我 3 年前实现它的方式......可能是更好的方法,比如 using __import__,但需要传递参数的方法等......

无论如何,运行时:

python main.py arg a,b,c..
Run Code Online (Sandbox Code Playgroud)

都好。

运行时:

jenkinsRun.py
Run Code Online (Sandbox Code Playgroud)

每次都应该使用 diff args 运行 main 我得到异常:

os.system('python main.py %s %s %s %s %s %s'%(STD,config.VpcStackName, '-dryrun', 'false', '-tenant' ,config.PROD_STAGE_Tenant))
Run Code Online (Sandbox Code Playgroud)

仅当我上周在我的新环境(请参阅上面的资源)上运行代码时才会发生这种情况,我有一个带有 ubuntu 15.04(旧)的旧虚拟机,一切运行良好(从那以后就没有接触过 vode)。

我已经从头开始在新的虚拟机上安装了库、驱动程序等。

有任何想法吗?

小智 12

可能是安装有问题。我确实在 MAC 上重新安装了它并且有效

sudo pip install awscli --ignore-installed six
Run Code Online (Sandbox Code Playgroud)


小智 5

如果您使用 boto3 作为依赖项,则 boto3 依赖项的管理方式存在错误。

尝试运行 pip3 install boto3 --upgrade更新 boto3,问题应该会得到解决!


Ral*_*alf 3

只是为了确保:您确定您正在调用吗Python 2.x

Ubuntu 18.04默认情况下Python 3.x,请确保您不会意外地使用其他 python 版本启动脚本。