Install MySQL-python in virtualenv on Windows 7

I am trying to install MySQL-python in my virtualenv (Windows 7 32b + Python 2.7.3), but unfortunately after the command:

pip install MySQL-python 

I get an error message:

 Install packages failed: Error occurred when installing package MySQL-python. The following command was executed: packaging_tool.py install --build-dir C:\Users\Grzegorz\AppData\Local\Temp\pycharm-packaging3577041299153334552.tmp MySQL-python The error output of the command: Downloading/unpacking MySQL-python Running setup.py egg_info for package MySQL-python Traceback (most recent call last): File "<string>", line 16, in <module> File "C:\Users\Grzegorz\AppData\Local\Temp\pycharm-packaging3577041299153334552.tmp\MySQL-python\setup.py", line 15, in <module> metadata, options = get_config() File "setup_windows.py", line 7, in get_config serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key']) WindowsError: [Error 2] Nie można odnaleźć określonego pliku Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 16, in <module> File "C:\Users\Grzegorz\AppData\Local\Temp\pycharm-packaging3577041299153334552.tmp\MySQL-python\setup.py", line 15, in <module> metadata, options = get_config() File "setup_windows.py", line 7, in get_config serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key']) WindowsError: [Error 2] Nie można odnaleźć określonego pliku ---------------------------------------- Command python setup.py egg_info failed with error code 1 in C:\Users\Grzegorz\AppData\Local\Temp\pycharm-packaging3577041299153334552.tmp\MySQL-python Storing complete log in C:\Users\Grzegorz\pip\pip.log 

If I try to install this package from the binary MySQL-python-1.2.3.win32-py2.7.exe, then everything will be installed correctly, but this is not a solution for me. Do you have any suggestions on how to correctly install this package on Windows 7 (all other packages that I can install without any problems)?

+7
source share
3 answers

You tried to use:

  easy_install MySQL-python 

This works for me on Windows 7 with Virtualenv. I had the same problem with pip.

+22
source

If you can install mysql-python globally (in C: / python27) from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

then you can copy the following files to the folder "C: / python / lib / site-packages": "/ lib / site-packages"

  • MySQL_python-1.2.4-py2.7.egg-info (folder)
  • MySQLdb (folder)
  • _mysql_exceptions.py/.pyc/.pyo
  • _mysql.pyd

** No need to copy mysql files from "C: \ Python27 \ Lib \ site-packages \ django \ db \ backends" or "C: \ Python27 \ Lib \ site-packages \ django \ contrib \ gis \ DB \ engines".

+11
source

SourceForge now has an MSI installer for Windows . Try this, but if you prefer to create your own until (until 1.2.4 is released), you can do this:

 pip install http://svn.code.sf.net/p/mysql-python/svn/branches/MySQLdb-1.2/MySQLdb 

The above assumes that you have Subversion installed.

+1
source

All Articles