-
Couldn't load subscription status.
- Fork 45
Install on Linux
Jasleen Kaur edited this page Jan 8, 2016
·
6 revisions
- Python 3 and headers (packages: python3 and python3-dev)
-
mysql_configutility along with MySQL headers (libmysqlclient-dev package) - compiler and linker
- Optionally MySQL for Python 3 tarball
(MySQL server nor client aren't required, in case your MySQL server are on another machine)
- Install Python 3 and also Python 3 headers
sudo apt-get install python3 python3-dev - check if
python3works - install libmysqlclient-dev package and it's dependencies. which will contain
mysql_configand MySQL headers. Also as dependencies gcc will be installed.sudo apt-get install libmysqlclient-dev
You can install it directly from git with pip3
pip3 install git+git://github.com/davispuh/MySQL-for-Python-3
Or manually
- download MySQL for Python 3 tarball
- extract it
- and now finally install it with
python3 setup.py install - can test if it was successfully installed by opening python3 and
import MySQLdb
- install MySQL server
sudo apt-get install mysql-server - create
test.pywith contents from [Usage example](Usage example) - edit settings (root password, etc) accordingly
- try it with
python3 test.py
apt-get is for Debian, Ubuntu distributions, if you've Fedora or CentOS then use yum. Different for others.