Tôi đang cố gắng thiết lập Django một cách tuyệt vọng, nhưng tôi liên tục gặp vấn đề.
Khi tôi chạy "Pip cài đặt mysql-python", tôi chạy vào một bức tường văn bản màu đỏ và các lỗi được hiển thị bên dưới.Vấn đề của tôi là tôi không thể cài đặt Django.
Đây là bài viết đầu tiên của tôi trên Stack Overflow, vì vậy hãy dễ dàng với tôi nếu tôi làm hỏng bất kỳ định dạng nào, v.v. Tôi không có kinh nghiệm về mã hóa và thực tế là tôi thậm chí không thể có được những thứ cơ bản như thế này để hoạt động là vô cùng nản lòng.
C:\WINDOWS\system32>pip install MySQL-python
Collecting MySQL-python
Using cached
//files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
Building wheel for MySQL-python [setup.py] ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\chrispa\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Chrispa\\AppData\\Local\\Temp\\pip-install-ts0ir3mr\\MySQL-python\\setup.py'"'"'; __file__='"'"'C:\\Users\\Chrispa\\AppData\\Local\\Temp\\pip-install-ts0ir3mr\\MySQL-python\\setup.py'"'"';f=getattr[tokenize, '"'"'open'"'"', open][__file__];code=f.read[].replace['"'"'\r\n'"'"', '"'"'\n'"'"'];f.close[];exec[compile[code, __file__, '"'"'exec'"'"']]' bdist_wheel -d 'C:\Users\Chrispa\AppData\Local\Temp\pip-wheel-4pjpg8hv' --python-tag cp37
cwd: C:\Users\Chrispa\AppData\Local\Temp\pip-install-ts0ir3mr\MySQL-python\
Complete output [29 lines]:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.7
copying _mysql_exceptions.py -> build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
C:\Program Files [x86]\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=[1,2,5,'final',1] -D__version__=1.2.5 "-IC:\Program Files [x86]\MySQL\MySQL Connector C 6.0.2\include" -Ic:\users\chrispa\appdata\local\programs\python\python37-32\include -Ic:\users\chrispa\appdata\local\programs\python\python37-32\include "-IC:\Program Files [x86]\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\ATLMFC\include" "-IC:\Program Files [x86]\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include" "-IC:\Program Files [x86]\Windows Kits\NETFXSDK\4.7.2\include\um" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tc_mysql.c /Fobuild\temp.win32-3.7\Release\_mysql.obj /Zl
_mysql.c
_mysql.c[42]: fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Program Files [x86]\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.22.27905\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for MySQL-python
Running setup.py clean for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\chrispa\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Chrispa\\AppData\\Local\\Temp\\pip-install-ts0ir3mr\\MySQL-python\\setup.py'"'"'; __file__='"'"'C:\\Users\\Chrispa\\AppData\\Local\\Temp\\pip-install-ts0ir3mr\\MySQL-python\\setup.py'"'"';f=getattr[tokenize, '"'"'open'"'"', open][__file__];code=f.read[].replace['"'"'\r\n'"'"', '"'"'\n'"'"'];f.close[];exec[compile[code, __file__, '"'"'exec'"'"']]' install --record 'C:\Users\Chrispa\AppData\Local\Temp\pip-record-wedev03m\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\Chrispa\AppData\Local\Temp\pip-install-ts0ir3mr\MySQL-python\
Complete output [29 lines]:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
copying _mysql_exceptions.py -> build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
C:\Program Files [x86]\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=[1,2,5,'final',1] -D__version__=1.2.5 "-IC:\Program Files [x86]\MySQL\MySQL Connector C 6.0.2\include" -Ic:\users\chrispa\appdata\local\programs\python\python37-32\include -Ic:\users\chrispa\appdata\local\programs\python\python37-32\include "-IC:\Program Files [x86]\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\ATLMFC\include" "-IC:\Program Files [x86]\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include" "-IC:\Program Files [x86]\Windows Kits\NETFXSDK\4.7.2\include\um" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tc_mysql.c /Fobuild\temp.win32-3.7\Release\_mysql.obj /Zl
_mysql.c
_mysql.c[42]: fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Program Files [x86]\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.22.27905\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\chrispa\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Chrispa\\AppData\\Local\\Temp\\pip-install-ts0ir3mr\\MySQL-python\\setup.py'"'"'; __file__='"'"'C:\\Users\\Chrispa\\AppData\\Local\\Temp\\pip-install-ts0ir3mr\\MySQL-python\\setup.py'"'"';f=getattr[tokenize, '"'"'open'"'"', open][__file__];code=f.read[].replace['"'"'\r\n'"'"', '"'"'\n'"'"'];f.close[];exec[compile[code, __file__, '"'"'exec'"'"']]' install --record 'C:\Users\Chrispa\AppData\Local\Temp\pip-record-wedev03m\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.