سلام استاد اردوخانی، ممنون میشم اگه راهنمایی کنید،
تو قسمت ترمینال سی پنل برا pip install mysqlclient به ارور بر میخوره که مانع migrate کردن میشه:
settings.py :
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '*******',
'USER': '********',
'PASSWORD': '********',
'HOST': 'localhost',
'PORT': '3306',
'OPTIONS': {
'sql_mode': 'ALL_STRIKT_TABLES'
}
}
}
متن ارور :
pip install mysqlclient
Collecting mysqlclient==1.3.12
Downloading mysqlclient-1.3.12.tar.gz (89 kB)
|████████████████████████████████| 89 kB 846 kB/s
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/arsadsho/virtualenv/arsad_eshop/3.8/bin/python3.8_bin -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-empsp26f/mysqlclient_fe71150702d449e9839fe29021702a49/setup.py'"'"'; __file__='"'"'/tmp/pip-install-empsp26f/mysqlclient_fe71150702d449e9839fe29021702a49/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-77ps9m_j
cwd: /tmp/pip-install-empsp26f/mysqlclient_fe71150702d449e9839fe29021702a49/
Complete output (31 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.8/MySQLdb
creating build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.8
/usr/bin/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -D_GNU_SOURCE -fPIC -fwrapv -O2 -fPIC -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 -I/usr/include/mysql -I/usr/include/mysql/.. -I/opt/alt/python38/include/python3.8 -c _mysql.c -o build/temp.linux-x86_64-3.8/_mysql.o
_mysql.c:32:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command '/usr/bin/gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /home/arsadsho/virtualenv/arsad_eshop/3.8/bin/python3.8_bin -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-empsp26f/mysqlclient_fe71150702d449e9839fe29021702a49/setup.py'"'"'; __file__='"'"'/tmp/pip-install-empsp26f/mysqlclient_fe71150702d449e9839fe29021702a49/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xwy9rz0h/install-record.txt --single-version-externally-managed --compile --install-headers /home/arsadsho/virtualenv/arsad_eshop/3.8/include/site/python3.8/mysqlclient
cwd: /tmp/pip-install-empsp26f/mysqlclient_fe71150702d449e9839fe29021702a49/
Complete output (31 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.8/MySQLdb
creating build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.8
/usr/bin/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -D_GNU_SOURCE -fPIC -fwrapv -O2 -fPIC -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 -I/usr/include/mysql -I/usr/include/mysql/.. -I/opt/alt/python38/include/python3.8 -c _mysql.c -o build/temp.linux-x86_64-3.8/_mysql.o
_mysql.c:32:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command '/usr/bin/gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/arsadsho/virtualenv/arsad_eshop/3.8/bin/python3.8_bin -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0]= '"'"'/tmp/pip-install-empsp26f/mysqlclient_fe71150702d449e9839fe29021702a49/setup.py'"'"'; __file__='"'"'/tmp/pip-install-empsp26f/mysqlclient_fe71150702d449e9839fe29021702a49/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xwy9rz0h/install-record.txt --single-version-externally-managed --compile --install-headers /home/arsadsho/virtualenv/arsad_eshop/3.8/include/site/python3.8/mysqlclient Check the logs forfull command output.
سلام دوست من
هنگام نصب mysqlclient ، نسخه ی مورد نظر رو هم وارد کنین
pip install mysqlclient==2.0.3