Python mysqldb connects to the database

  • 2020-04-02 09:23:25
  • OfStack

There is no way to the next 2.6, if 2.4 is too low, and about, half a day to find the installation file mysql-python-1.2.2. win32-py2.6.exe, the installation is completed, the execution of import MySQLdb problems prompt:
File "C:\Python26\lib\site-packages\MySQLdb\ \ init__. Py ", line 19, in < The module >
ImportError: DLL load failed: the specified module could not be found.
After numerous searches, the official statement is not very correct, the official solution is LD_LIBRARY_PATH load such an environment variable, loading the same can not solve the problem, more means refers to the Linux processing,
Win is not above, and found countless data, is missing two DLL files for libguide40.dll, libmmd. DLL search, download a lot of places, and then copy to WINDOWS\system32 below now execute again
Error. This is amazing. The error is:
Sys :1: DeprecationWarning: the sets module is deprecated
For this error, I searched countless materials and read a lot of things, and finally found that it was not recommended to use the module sets in version 2.6. However, I still loaded the module for compatibility, but I gave warning, which made me think a lot
Many ways not to let the warning information out or catch exceptions, etc. Did not succeed, took the worst way, modify the original file, go into the python installation directory found the following file Python26\Lib\sets.py comment out lines 83-85
# import warnings
# warnings. Warn (" the sets the module is deprecated ", DeprecationWarning, stacklevel = 2)
That's it. I've merged it up into two rows.
Up to now mysqldb installed, without any error output, also understand, why the official release of version 2.6 of mysqldb.
Python3k should already be supported, so since the official release, there has been no real version, which means that python3k is not yet able to use the mysqldb space to connect to mysql. And a lot of work
It seems that there is still a long way to go to achieve the popularity of 3k. At this stage, those who want to learn python will have to continue to choose and suffer.

My GUI took me a day before I even started.

Related articles: