Installing oursql is mostly like installing any other python package. It’s strongly recommended to use your platform’s package manager if there is a package for oursql, a binary release from launchpad if not, and only to compile from source if nothing else is available.


oursql requires python 2.4 or better, and MySQL 4.1.2 or better.

Only the MySQL C client libraries are required for oursql. These libraries are available separately if it’s not essential to download/install the entire MySQL package.

Using pip

On systems where there is a mysql_config command, using pip is trivial:

pip install oursql

If mysql_config is not named mysql_config, the environment can be set to indicate the actual name:

MYSQL_CONFIG=mysql_config5 pip install oursql

If there is no mysql_config, you must determine the necessary CFLAGS and LDFLAGS yourself and pass them to pip.

Getting oursql

The newest release of oursql will always be available on its project site on launchpad:

Installing from source

On systems where there is a mysql_config command, using distutils is also trivial:

python build_ext
python install

If mysql_config is not named mysql_config, you can tell build_ext to try a different name using command-line flags or environment variables:

python build_ext --mysql-config=mysql_config5
# (or!)
MYSQL_CONFIG=mysql_config5 python build_ext
python install

On Windows, will try checking the registry to determine what the path to your MySQL installation is. By default, it will only check for an installation of MySQL 5.0. An alternate registry key or MySQL installation root can be passed to build_ext:

python build_ext "--mysql-registry-key=SOFTWARE\MySQL AB\MySQL Server 5.1"
python install

python build_ext "--mysql-root=C:\Program Files\MySQL\MySQL Server 5.1"
python install

Table Of Contents

Previous topic


Next topic


This Page