当前位置:网站首页>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
边栏推荐
- 我和 TiDB 的故事 | 缘份在,那就终是能相遇的
- Shared_preload_libraries cause many syntaxes not supported
- 布局管理器
- TiFlash 源码阅读(五) DeltaTree 存储引擎设计及实现分析 - Part 2
- 如何设计一个注册中心
- Linux Redis cache avalanche, breakdown, penetration
- 2022-08-02 Analyze RK817 output 32k clock PMIC_32KOUT_WIFI to WiFi module clock register devm_clk_hw_register
- Wang Shuang's Assembly Language Chapter 4: The First Program
- Convert callback function to Flow
- Grafana9.0发布,Prometheus和Loki查询生成器、全新导航、热图面板等新功能!
猜你喜欢
随机推荐
ZbxTable 2.0 重磅发布!6大主要优化功能!
我和 TiDB 的故事 | TiDB 对我不离不弃,我亦如此
字符流与字节流的区别
Anton Paar安东帕密度计比重计维修DMA35性能参数
思想茶叶蛋 (Jul 31,2022)| 元宇宙(Metaverse)下了一枚什么样的蛋
spark算子讲解
递归思想
加降息与BTC流动性事件策略研究
【高并发基石】多线程、守护线程、线程安全、线程同步、互斥锁
Unity3D 数据加密
DNS 查询原理详解—— 阮一峰的网络日志
三层交换机/路由器OSPF配置详解【华为eNSP实验】
js-第一个出现两次的字母
户外徒步旅行
技术实现 | 图像检索及其在淘宝的应用
How to write patents are more likely to pass?
新特性解读 | MySQL 8.0 在线调整 REDO
速速脱单诀窍
【正点原子STM32连载】第一章 本书学习方法 摘自【正点原子】MiniPro STM32H750 开发指南_V1.1
去掉js代码文件所有注释