1. install MySQL-python-1.2.3.win-amd64-py2.7.exe, when prompted: Python version 2.7 required, which was not found in the registry
This is in the registry can not identify python2.7, the reason windows is 64-bit, the installation of Python is 32-bit
Note: MySQLdb for python (32/64 bit) download; http://www.codegood.com/archives/129; different versions are available, choose the py you need
The solution is:
1. Create a new register.py file in any disk folder
Copy the following code into it:
import sys
from _winreg import *
# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
regpath = “SOFTWARE\\Python\\Pythoncore\\%s\\” % (version)
installkey = “InstallPath”
pythonkey = “PythonPath”
pythonpath = “%s;%s\\Lib\\;%s\\DLLs\\” % (
installpath, installpath, installpath
)
def RegisterPy():
try:
reg = OpenKey(HKEY_CURRENT_USER, regpath)
except EnvironmentError as e:
try:
reg = CreateKey(HKEY_CURRENT_USER, regpath)
SetValue(reg, installkey, REG_SZ, installpath)
SetValue(reg, pythonkey, REG_SZ, pythonpath)
CloseKey(reg)
except:
print “*** Unable to register!”
return
print “— Python”, version, “is now registered!”
return
if (QueryValue(reg, installkey) == installpath and
QueryValue(reg, pythonkey) == pythonpath):
CloseKey(reg)
print “=== Python”, version, “is already registered!”
return
CloseKey(reg)
print “*** Unable to register!”
print “*** You probably have another Python installation!”
if __name__ == “__main__”:
RegisterPy()
2. Locate the directory where the file is located and run python register.py
3. If you run MySQLdb, it will be automatically recognized and installed successfully
Similar Posts:
- Solving an error: unable to find vcfarsall.bat experience
- Error reporting using Yum: Yum except keyboardinterrupt, e
- Python Standard Library: functools (cmp_to_key, lru_cache, total_ordering, partial, partialmethod, reduce, sing…
- Solve the problem of “typeerror: ‘bool’ object is not callable” in flash and Django
- [Solved] android.content.ActivityNotFoundException: Unable to find explicit activity class
- [Solved] SQLAlchemy Error: ImportError: cannot import name ‘TYPE_CHECKING’
- TypeError: the JSON object must be str, not ‘bytes’
- Solve the problem of import error: cannot import name webriver
- The execution order of return statement in try except else finally in Python
- [Solved] ImportError: cannot import name pywrap_tensorflow