Mac Install Mysql Python
MySQLdb is an api for accessing MySQL database using python. It is built on top of MySQL C API. MySQLdb don’t yet have support for python 3, it supports only python 2.4 – 2.7. As a result you need to use python 2 for this tutorial. We will be using python 2.7.9, which you can download from here. Installing MySQLdb. I am using OSX 10.8 and PyCharm to work on a Python development project. I have installed MySQL-python for the mac using the instructions on the website. Oct 31, 2008 How to install MySQL-python on Mac OS X Step 1: Brace yourself, this proccess is really really annoying. Step 2: Download MySQL for Mac (Skip. Nov 16, 2012 MacPorts has a port for MySQLdb (py-mysql and variants). If Homebrew has a 'formula', I can't find it, but a pip install should work once you have compatible versions of Python and MySQL. The hard way The hard part about the Mac is, there are three architectures you could be building for: PowerPC, Intel 32-bit, and Intel 64-bit.
How can I install the MySQLdb module for Python using pip?
Install MySQL Connector Python on Windows, Linux, Unix, MacOs using PIP or using ZIP and TAR file. We can also install using MSI installer and RPM package.Prerequisites for installing MySQL Connector Python.
19 Answers
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
Nick TStarting 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/
Ray KiddyRay KiddyI 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 via
pip 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.
kyreniakyreniaFirst
Then put the code below into __init__.py
(projectname/__init__.py
)
My environment is (python3.5, django1.10) and this solution works for me!
An Introduction To Language 7th Edition.pdf - Free download Ebook, Handbook, Textbook, User Guide PDF files on the internet quickly and easily. Habib Fauzie. Loading Preview. Download pdf × Close Log In. Log In with Facebook Log In with Google. Email: Password: Remember me on this computer. Download pdf × Close Log In. An Introduction To Language Seventh Edition.pdf - Free download Ebook, Handbook, Textbook, User Guide PDF files on the internet quickly and easily. An introduction to language 7th edition pdf.
Hope this helps!!
NickDI tried all the option but was not able to get it working on Redhat platform.I did the following to make it work:-
Once the package was installed was able to import module as follows in the interpreter:-
AshwinAshwinGo to pycharm then go to default setting --> pip (double click) -- pymsqldb.-- > install --after installing use in a program like this
Benoît LatinierIf you are use Raspberry Pi [Raspbian OS]
There are need to be install pip command at first
So that just install Sequently
Héctor Valverde ParejaYou can go to this website to download the package.
hg8If 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
quinzI had the same problem too.Follow these steps if you are on Windows.Go to:1.My Computer2.System Properties3.Advance System Settings4. 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
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!
pip install mysql-connector-python
as noted in the documentation:
on RHEL 7:
sudo yum install yum-utils mariadb-devel python-pip python-devel gcc
sudo /bin/pip2 install MySQL-python
If you have Windows installed on your system then type the following command on cmd :
Mysql
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.
My environment are:
- Windows 10 Pro,
- Python 3.7 (python-3.7.1-amd64.exe),
- MySQL 8.0 (mysql-installer-web-community-8.0.13.0.msi)
pip install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
works for me.
actually, follow @Nick T's answer doesn't work for me, i try apt-get install python-mysqldb
work for me