当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
redis分布式锁的实现
ShuffleNet v2网络结构复现(Pytorch版)
Recommend several methods that can directly translate PDF English documents
sync-diff-inspector 使用实践
【高并发基石】多线程、守护线程、线程安全、线程同步、互斥锁
csdn图片去水印 | 其他方法无效时的解决方案
2022年制冷与空调设备运行操作特种作业证考试题库及模拟考试
Shared_preload_libraries导致很多语法不支持
基于cRIO-904X搭建Simulink与Labview环境
四大网络攻击常见手段及防护
JNI学习1.环境配置与简单函数实现
Unity3D data encryption
从零开始的tensorflow小白使用指北
记录十条工作中便利的API小技巧
【论文笔记】Understanding Long Programming Languages with Structure-Aware Sparse Attention
Thread类的基本使用。
微信消息从发送到接收,经历了什么?如何防止丢包
B站回应HR称“核心用户都是Loser”、求职者是“白嫖党”:已被劝退
有坦荡的远方
2022-08-02 Analyze RK817 output 32k clock PMIC_32KOUT_WIFI to WiFi module clock register devm_clk_hw_register









