当前位置:   article > 正文

ImportError: cannot import name ‘soft_unicode‘ from ‘markupsafe‘ (C:\Users\xxx\AppData\Local\Program_importerror: cannot import name 'soft_unicode' fro

importerror: cannot import name 'soft_unicode' from 'markupsafe

windows安装httprunner 3.1.6版本遇到报错(ImportError: cannot import name 'soft_unicode' from 'markupsafe' (C:\Users\wlm\AppData\Local\Programs\Python\Python39\lib\site-packages\markupsafe\__init__.py))

解决方案:pip install -U httprunner==3.1.11   #安装3.1.11版本

如有以下依赖库的报错,可参考进行升级版本,解决过程如下

步骤1:pip install httprunner==3.1.6

结果1:ImportError: cannot import name 'soft_unicode' from 'markupsafe' (C:\Users\xx\AppData\Local\Programs\Python\Python39\lib\site-packages\markupsafe\__init__.py)

注释:提示markupsafe库里少了soft_unicode,解决方法,更新markupsafe库

步骤2:pip install markupsafe==2.0.1 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com       # pip install -U MarkupSafe==2.1.1(这条命令会timeout)

结果2:ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
werkzeug 2.2.1 requires MarkupSafe>=2.1.1, but you have markupsafe 2.0.1 which is incompatible.
flask 2.1.3 requires Jinja2>=3.0, but you have jinja2 2.11.3 which is incompatible.

注释:需要升级markupsafe 和jinja2 两个库的版本

步骤3.1:pip install -U markupsafe==2.1.1 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

步骤3.1:pip install -U jinja2==3.0

结果:ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
httprunner 3.1.6 requires jinja2<3.0.0,>=2.10.3, but you have jinja2 3.0.0 which is incompatible.

注释:升级完依赖库版本后,又绕回来了,追根究底是httprunner==3.1.6版本本身和我环境的问题,果断换版本。3.1.11是httprunner3系的最后一个版本.httpruner 官网地址

 

问题解决后:httprunner安装成功验证:httprunner -h,如下图即成功

 如下图即安装失败,hrrprunner 命令不可用,httprunner startproject demo不可用;

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/191371
推荐阅读
相关标签
  

闽ICP备14008679号