当前位置:网站首页>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_cache
Resolved
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_string
from werkzeug.utils import import_string
Change 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 = None
Credits
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
边栏推荐
猜你喜欢
Fiddler(二)-手机抓包502错误解决方法
Yolov5更换主干网络之《旷视轻量化卷积神经网络ShuffleNetv2》
三层交换机/路由器OSPF配置详解【华为eNSP实验】
【正点原子STM32连载】第四章 STM32初体验 摘自【正点原子】MiniPro STM32H750 开发指南_V1.1
.NET深入解析LINQ框架(五:IQueryable、IQueryProvider接口详解)
spark算子讲解
【CNN基础】转置卷积学习笔记
Yolov5 replaces the backbone network of "Megvii Lightweight Convolutional Neural Network ShuffleNetv2"
下午14:00面试,14:08低着头出来了 ,问的实在是太...
反序列化漏洞
随机推荐
线程和进程之间的区别
async - await
yolo x 跑起来,详细的不行,且内含800错误解决办法
Fiddler(一)安装
递归思想
TiCDC迁移-TiDB到MySQL测试
布局管理器
MATLAB绘图总结
并发编程之生产者和消费者问题
Quick tips for getting out of a single
线程安全问题
云函数实现网站自动化签到配置详解【Web函数/Nodejs/cookie】
技术实现 | 图像检索及其在高德的应用
从零开始C语言精讲篇6:结构体
交换机链路聚合详解【华为eNSP】
2022年化工自动化控制仪表考试模拟100题及模拟考试
Interpretation of new features | MySQL 8.0 online adjustment REDO
用OpenGL绘制winXP版扫雷的笑脸表情
命里有时终须有--记与TiDB的一次次擦肩而过
RL学习笔记(一)