我正在尝试从 werkzeug.utils 导入secure_filename,但它会出错。它在我的基本虚拟环境下运行良好。
代码:
# Flask packages
from flask import Flask, render_template, request, session, redirect, flash, send_file
from flask_bootstrap import Bootstrap
from flask_uploads import UploadSet,configure_uploads,IMAGES,DATA,ALL
# Systems
import os
import sys
import json
from werkzeug.utils import secure_filename
错误:
(absa_annotation) C02QM3FSFVH3:ABSA-annotation-tool kwunkeilau$ python3 app.py
Traceback (most recent call last):
File "app.py", line 4, in <module>
from flask_uploads import UploadSet,configure_uploads,IMAGES,DATA,ALL
File "/Users/kwunkeilau/anaconda3/envs/absa_annotation/lib/python3.7/site-packages/flask_uploads.py", line 26, in <module>
from werkzeug import secure_filename, FileStorage
ImportError: cannot import name 'secure_filename' from 'werkzeug' (/Users/kwunkeilau/anaconda3/envs/absa_annotation/lib/python3.7/site-packages/werkzeug/__init__.py)