In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Django currently supports three mysql drivers for mysql linking.
MySQLdb is a native driver that has been developed and supported for over a decade by Andy Dustman.
Mysqlclient is a fork of MySQLdb which notably supports Python 3 and can be used as a drop-in replacement for MySQLdb. At the time of this writing, this is the recommended choice for using MySQL with Django.
MySQL Connector/Python is a pure Python driver from Oracle that does not require the MySQL client library or any Python modules outside the standard library.
Mysqldb currently does not support python3+, recommended mysqlclient.
Tried to install mysqlclient directly on pycharm with the following error: OSError: mysql_config not found
Review the installation steps on git:
Prerequisites
You may need to install the Python and MySQL development headers and libraries like so:
Sudo apt-get install python-dev libmysqlclient-dev # Debian / Ubuntu
Sudo yum install python-devel mysql-devel # Red Hat / CentOS
On Windows, there are binary wheel you can install without MySQLConnector/C or MSVC.
Note on Python 3: if you are using python3 then you need to install python3-dev using the following command:
Sudo apt-get install python3-dev # debian / Ubuntu
Sudo yum install python3-devel # Red Hat / CentOS
Brew install mysql-connector-c # macOS (Homebrew)
Install from PyPI
Pip install mysqlclient
Because I use python3 on mac, execute the command first:
Brew install mysql-connector-c
Then execute:
Pip3 install mysqlclient
The following error is reported:
Command "python setup.py egg_info" failed with error code 1 in / private/tmp/pip-build-m9v70gan/mysqlclient/
This place is a little confusing: after using the pip3 command, the final call is python, not python3.
Looking at the source code of mysqlclient, it is found that the root cause is that mysql_config is not found. I understand that it is necessary to install mysql in order to install mysqlclient normally.
Installed / Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysqlclient-1.3.10-py3.6-macosx-10.6-intel.egg
Processing dependencies for mysqlclient==1.3.10
Finished processing dependencies for mysqlclient==1.3.10
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.