Heim  >  Fragen und Antworten  >  Hauptteil

Fehler bei der Installation von mysqlclient im Django-Projekt auf cPanel

Requirements.txt enthält:

asgiref==3.4.1
Django==3.2.9
django-isbn-field==0.5.3
mysql-connector-python
mysqlclient
phonenumberslite==8.12.42
Pillow==9.0.1
python-decouple==3.6
python-stdnum==1.17
pytz==2021.3
six==1.16.0
sqlparse==0.4.2

Ein Fehler ist aufgetreten:

Error
ERROR: Failed building wheel for mysqlclient
ERROR: Command errored out with exit status 1: /home/bookbestie/virtualenv/bookbestie/3.8/bin/python3.8_bin -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nk4wll31/mysqlclient_306f3e44780f440a9c0a625d98f95d89/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nk4wll31/mysqlclient_306f3e44780f440a9c0a625d98f95d89/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-frd2zcuu/install-record.txt --single-version-externally-managed --compile --install-headers /home/bookbestie/virtualenv/bookbestie/3.8/include/site/python3.8/mysqlclient Check the logs for full command output.
WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
You should consider upgrading via the '/home/bookbestie/virtualenv/bookbestie/3.8/bin/python3.8_bin -m pip install --upgrade pip' command.

Das ist das erste Mal, dass ich Gastgeber bin. Ich habe andere gepostete Fragen durchgesehen, kann aber keine Lösung finden.

P粉685757239P粉685757239259 Tage vor411

Antworte allen(1)Ich werde antworten

  • P粉195402292

    P粉1954022922024-02-04 16:17:46

    使用的PyMySQL版本:pip install pymysql==1.0.2

    使用的Django版本:pip install django==3.2

    然后在settings.py

    ...

    import pymysql
    pymysql.install_as_MySQLdb()

    ...

    然后就可以正常运行了。

    Antwort
    0
  • StornierenAntwort