**我正在尝试将 Mysql 连接到 Django **
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'djsql',
'USER':'root',
'PASSWORD' : 'root',
'HOST':'127.0.0.1',
'PORT':'3306',
}}
尝试运行:
pip install msqlclient
和
python manage.py migrate
出现错误:
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\Dell\AppData\Local\Temp\pip-install-u0zn06ml\migrate_37874a5e96fe48ffb9d7bebe813702bc\setup.py", line 26, in <module>
import migrate
File "C:\Users\Dell\AppData\Local\Temp\pip-install-u0zn06ml\migrate_37874a5e96fe48ffb9d7bebe813702bc\migrate.py", line 18, in <module>
import pwd
ModuleNotFoundError: No module named 'pwd'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
无法找到错误密码!!
这可能有用:
pip install pwd