How can I install the MySQLdb module for Python using pip?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
If you have Windows installed on your system then type the following command on cmd :
if the above command does not work try using:
Now,if the above commands do not get the work done, try using:
That's it you are good to go now.
I had the same problem too.Follow these steps if you are on Windows. Go to: 1.My Computer 2.System Properties 3.Advance System Settings 4. Under the "Advanced" tab click the button that says "Environment Variables" 5. Then under System Variables you have to add / change the following variables: PYTHONPATH and Path. Here is a paste of what my variables look like: python path:
path:
See this link for reference
It's easy to do, but hard to remember the correct spelling:
If you need 1.2.x versions (legacy Python only), use
pip install MySQL-python
Note: Some dependencies might have to be in place when running the above command. Some hints on how to install these on various platforms:
Ubuntu 14, Ubuntu 16, Debian 8.6 (jessie)
Fedora 24:
Mac OS
if that fails, try
For Python3 I needed to do this:
You can go to this website to download the package.
I had problems installing the 64-bit version of MySQLdb on Windows via Pip (problem compiling sources) [32bit version installed ok]. Managed to install the compiled MySQLdb from the .whl file available from http://www.lfd.uci.edu/~gohlke/pythonlibs/
The .whl file can then be installed via pip as document in https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels
For example if you save in
C:/
the you can install viapip install c:/MySQL_python-1.2.5-cp27-none-win_amd64.whl
Follow-up: if you have a 64bit version of Python installed, then you want to install the 64-bit AMD version of MySQLdb from the link above [i.e. even if you have a Intel processor]. If you instead try and install the 32-bit version, I think you get the unsupported wheel error in comments below.