User Tools

Site Tools


Use Python 3.4 + MySQL Connector on Debian 7 Wheezy

Debian 7 Wheezy ships with Python 3.2 (a bit outdated) and mysql-connector-python 2.0 works only with Python 3.3 o later versions. However, you can setup your own Python 3.4 virtual environment and run your script inside it (main source: [1])

The necessary libs to build the optional modules can be istalled with

sudo apt-get install build-essential libncurses5-dev libncursesw5-dev libreadline6-dev libgdbm-dev libsqlite3-dev liblzma-dev libbz2-dev tk-dev zlib1g-dev libssl-dev

May be you would also need (are they really needed? to be confirmed)

sudo apt-get install libdb5.1-dev libexpat1-dev 

Now compile and install Python with

cd /tmp
tar -xf Python-3.4.2.tar.xz
cd Python-3.4.2
./configure --prefix=/usr/local/opt/python-3.4.2
sudo make install
cd /tmp
sudo rm -rf Python-3.4.2

Setup a Virtual Environment for you project

cd ~/myproject/
/usr/local/opt/python-3.4.1/bin/pyvenv virtualenv-3.4.2

Install mysql-connector-python 2.0 from source

source virtualenv-3.4.2/bin/activate
pip3.4 install

Run your python3 project with

source virtualenv-3.4.2/bin/activate


notes/install-python-3.4-and-mysql-connector-on-debian-7-wheezy.txt · Last modified: 2014/11/29 00:22 by admin