我正在使用 Flask 试用 Python 3,但在使用数据库时遇到了以下错误。
我在 macOS High Sierra v. 10.13.6 上执行此操作
我的导入代码如下:
from flask import Flask, render_template, flash, redirect, url_for, session, request, logging
from data import Articles
from flask_mysqldb import MySQL
from wtforms import Form, StringField, TextAreaField, PasswordFeild, validators
from passlib.hash import sha256_crypt
我在尝试运行应用程序时遇到的错误如下:
Traceback (most recent call last):
File "app.py", line 3, in <module>
from flask_mysqldb import MySQL
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/flask_mysqldb/__init__.py", line 1, in <module> import MySQLdb
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/MySQLdb/__init__.py", line 18, in <module> import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/_mysql.cpython-37m-darwin.so, 2): Library not loaded:
libssl.1.0.0.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/_mysql.cpython-37m-darwin.so
Reason: image not found
我已经查看了与我相关的多个其他问题,但似乎找不到任何可以解决我的问题的问题。或者至少我不知道怎么做。我真的希望有人可以帮助我。