返回顶部
首页 > 资讯 > 后端开发 > Python >ImportError: cannot import name ‘soft_unicode‘ from ‘markupsafe‘ (C:\Users\xxx\AppData\Local\Program
  • 889
分享到

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

pythonhttprunner 2023-09-04 15:09:26 889人浏览 薄情痞子

Python 官方文档:入门教程 => 点击学习

摘要

windows安装Httprunner 3.1.6版本遇到报错(ImportError: cannot import name 'soft_unicode' from 'markupsafe' (C:\Users\wlm\AppData\L

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不可用;

 

 

来源地址:https://blog.csdn.net/leng_nuan/article/details/126173301

--结束END--

本文标题: ImportError: cannot import name ‘soft_unicode‘ from ‘markupsafe‘ (C:\Users\xxx\AppData\Local\Program

本文链接: https://lsjlt.com/news/393812.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作