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
Starting from a fresh Ubuntu 14.04.2 system, these two commands were needed:
Just doing the "pip install" by itself did not work.
From http://codeinthehole.com/writing/how-to-set-up-mysql-for-python-on-ubuntu/
Go to pycharm then go to default setting --> pip (double click) -- pymsqldb..-- > install --after installing use in a program like this
My environment are:
pip install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
works for me.
First
Then put the code below into init.py(projectname/init.py)
My environment (python3.5,django1.10) and it work for me!
Hope help!!
If you are unable to install mysqlclient you can also install pymysql:
pip install pymysql
This works same as MySqldb. After that use pymysql all over instead of MySQLdb
The above answer is great, but there may be some problems when we using pip to install MySQL-python in Windows
for example,It needs some files that are associated with Visual Stdio .One solution is installing VS2008 or 2010……Obviously,it cost too much.
Another way is the answer of @bob90937 . I am here to do something to add.
with http://www.lfd.uci.edu/~gohlke/pythonlibs, u can download many Windows binaries of many scientific open-source extension packages for the official CPython distribution of the Python programming language.
Back to topic,we can choose the MySQL-python(py2) or Mysqlclient(py3) and use pip install to install. it gives us Great convenience!