当前位置:网站首页>cannot import name 'import_string' from 'werkzeug' [bug solution]
cannot import name 'import_string' from 'werkzeug' [bug solution]
2022-08-04 09:01:00 【Progressive small vegetable pig】
BUG
ImportError: cannot import name 'import_string' from 'werkzeug' (/home/cc/Desktop/test/alg/envi/lib/python3.8/site-packages/werkzeug/init.py)
cannot import name 'import_string' from 'werkzeug'
This happens because of version incompatibility.
from werkzeug.utils import import_stringimport werkzeugwerkzeug.import_string = import_stringimport flask_cacheResolved

Change the version of Werkzeug to 0.16.1
Werkzeug==0.16.1
Problem solved
reason
The new version and the old version have different rules:
As follows:
from werkzeug import import_stringfrom werkzeug.utils import import_stringChange the unity to solve.
Reason
The rules of the new version and the old version are different:
As follows:
from werkzeug import import_string
from werkzeug.utils import import_string
It can be solved by changing the unity.
import_string
Importing objects based on strings
Freeware: ISC License
Features
Importing objects based on strings.This is useful if you want to use the import path as an endpoint or something similar.Import paths can be specified in dashed notation (.) or using a colon as an object separator (:).If silent is True, the return value will be None if the import fails.
Usage
import import_stringmodule = import_string('my_system.my_package.my_module')function = import_string('my_system.my_module:some_function')Class = import_string('my_system.my_module:SomeClass', silent=True) If path doesn't exist Class = NoneCredits
This package was extracted from the werkzeug.utils module
This package was created with the cookie cutter and the audreyr/cookiecutter-pypackage project template.
Stable Release
To install import_string, run the following command in a terminal:
$ pip install import_string
This is the preferred way to install import_string as it will always install the latest stable version.
If you don't have pip installed, this Python installation guide can guide you through the process.
From Source
The source code for import_string can be downloaded from the Github repository.
You can clone the public repository:
$ git clone git://github.com/rochacbruno/import_string
or download the tarball:
$ curl -OL https://github.com/rochacbruno/import_string/tarball/master
Once you have a copy of the source code, you can install it with:
$ python setup.py install
边栏推荐
猜你喜欢

inject() can only be used inside setup() or functional components.

【论文笔记】Delving into the Estimation Shift of Batch Normalization in a Network

【正点原子STM32连载】第三章 开发环境搭建 摘自【正点原子】MiniPro STM32H750 开发指南_V1.1

图的基本概念

去掉js代码文件所有注释

spark算子讲解

ZbxTable 2.0 重磅发布!6大主要优化功能!

我和 TiDB 的故事 | 缘份在,那就终是能相遇的

如何设计一个注册中心

.NET深入解析LINQ框架(五:IQueryable、IQueryProvider接口详解)
随机推荐
Quick tips for getting out of a single
【UE虚幻引擎】UE5实现动态导航样条线绘制
Grafana9.0发布,Prometheus和Loki查询生成器、全新导航、热图面板等新功能!
sync-diff-inspector 使用实践
VRRP+MSTP配置详解【华为eNSP实验】
将jpg图片转换成yuv420(NV12)数据文件
DWB主题事实及ST数据应用层构建,220803,,
占位,稍后补上
async - await
三层交换机/路由器OSPF配置详解【华为eNSP实验】
tcp连接的细节
【Attention】Dual Attention(DANet) & Fully Attention(FLA)
从底层看 Redis 的五种数据类型
软件工程国考总结——判断题
思想茶叶蛋 (Jul 31,2022)| 元宇宙(Metaverse)下了一枚什么样的蛋
【正点原子STM32连载】第三章 开发环境搭建 摘自【正点原子】MiniPro STM32H750 开发指南_V1.1
Since his 97, I roll but he...
外包干了四年,秋招终于上岸了
How to import data from PG to kingbaseES
已解决No module named ‘flask_misaka‘【BUG解决】