gpt4 book ai didi

python - 属性错误: 'module' object has no attribute 'SSLContext'

转载 作者:行者123 更新时间:2023-12-02 06:46:26 28 4
gpt4 key购买 nike

当我使用flask run时,出现此错误。

Traceback (most recent call last):
File "/Users/xuye/anaconda/bin/flask", line 11, in <module>
sys.exit(main())
File "/Users/xuye/anaconda/lib/python2.7/site-packages/flask/cli.py", line 894, in main
cli.main(args=args, prog_name=name)
File "/Users/xuye/anaconda/lib/python2.7/site-packages/flask/cli.py", line 557, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "/Users/xuye/anaconda/lib/python2.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/xuye/anaconda/lib/python2.7/site-packages/click/core.py", line 1135, in invoke
sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
File "/Users/xuye/anaconda/lib/python2.7/site-packages/click/core.py", line 641, in make_context
self.parse_args(ctx, args)
File "/Users/xuye/anaconda/lib/python2.7/site-packages/click/core.py", line 940, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
File "/Users/xuye/anaconda/lib/python2.7/site-packages/click/core.py", line 1477, in handle_parse_result
self.callback, ctx, self, value)
File "/Users/xuye/anaconda/lib/python2.7/site-packages/click/core.py", line 96, in invoke_param_callback
return callback(ctx, param, value)
File "/Users/xuye/anaconda/lib/python2.7/site-packages/flask/cli.py", line 693, in _validate_key
is_context = isinstance(cert, ssl.SSLContext)
AttributeError: 'module' object has no attribute 'SSLContext'

我已经搜索并更新了我的Python版本到2.7.15,但它不起作用。

最佳答案

我遇到了同样的错误,我认为这是我在激活虚拟环境的情况下安装了flask和MarkupSafe(需要升级)。我解决这个问题的方法是在激活 venv 的情况下卸载 Flask 和 MarkupSafe,关闭 cmd,在新的终端中再次安装 Flask 和 Markupsafe,然后激活虚拟环境。这对我有用!

关于python - 属性错误: 'module' object has no attribute 'SSLContext' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53482236/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com