mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-08-04 08:04:45 +00:00
203 lines
10 KiB
HTML
203 lines
10 KiB
HTML
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="./">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<title>Installation — MariaDB Connector/Python 1.1.13 documentation</title>
|
||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
||
<link rel="stylesheet" type="text/css" href="_static/classic.css?v=2bf1fcf8" />
|
||
|
||
<script src="_static/documentation_options.js?v=1240c0c0"></script>
|
||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="next" title="Basic usage" href="usage.html" />
|
||
<link rel="prev" title="MariaDB Connector/Python" href="index.html" />
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="usage.html" title="Basic usage"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="index.html" title="MariaDB Connector/Python"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="index.html">MariaDB Connector/Python 1.1.13 documentation</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">Installation</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section class="tex2jax_ignore mathjax_ignore" id="installation">
|
||
<span id="id1"></span><h1>Installation<a class="headerlink" href="#installation" title="Link to this heading">¶</a></h1>
|
||
<section id="prerequisites">
|
||
<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Link to this heading">¶</a></h2>
|
||
<p>The current MariaDB Connector/Python implementation supports</p>
|
||
<ul class="simple">
|
||
<li><p>Python versions from 3.9 to 3.13</p></li>
|
||
<li><p>MariaDB server versions from version 10.3 or MySQL server versions from version 5.7.</p></li>
|
||
<li><p>MariaDB client library (MariaDB Connector/C) from version 3.3.1.</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="binary-installation">
|
||
<h2>Binary installation<a class="headerlink" href="#binary-installation" title="Link to this heading">¶</a></h2>
|
||
<section id="microsoft-windows">
|
||
<h3>Microsoft Windows<a class="headerlink" href="#microsoft-windows" title="Link to this heading">¶</a></h3>
|
||
<p>To install MariaDB Connector/Python on Microsoft Windows, you first have to install a recent version of MariaDB Connector/C. MSI installer for
|
||
both 32-bit and 64-bit operating systems are available from <code class="docutils literal notranslate"><span class="pre">MariaDB</span> <span class="pre">Connector</span> <span class="pre">Download</span> <span class="pre">page</span> <span class="pre"><https://mariadb.com/downloads/connectors/></span></code>__.</p>
|
||
<p>After installation of MariaDB Connector/C download and install MariaDB Connector/Python with the following command:</p>
|
||
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">pip3 install mariadb</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>On success, you should see a message at the end “Successfully installed mariadb-x.y.z”, where x.y.z is
|
||
the recent version of MariaDB Connector/Python.</p>
|
||
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">Collecting mariadb</span>
|
||
<span class="go">Downloading mariadb-1.1.5-cp310-cp310-win_amd64.whl (190 kB)</span>
|
||
<span class="go">---------------------------------------- 190.9/190.9 kB 2.9 MB/s eta 0:00:00</span>
|
||
<span class="go">Installing collected packages: mariadb</span>
|
||
<span class="go">Successfully installed mariadb-1.1.5</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
<section id="installation-from-source">
|
||
<h2>Installation from Source<a class="headerlink" href="#installation-from-source" title="Link to this heading">¶</a></h2>
|
||
<section id="build-prerequisites">
|
||
<h3>Build prerequisites<a class="headerlink" href="#build-prerequisites" title="Link to this heading">¶</a></h3>
|
||
<p>The following build prerequisites are required to install or build MariaDB Connector/Python from source code, github or from
|
||
<a class="reference external" href="http://pypi.org">pypi.org</a>.</p>
|
||
<p>To install MariaDB Connector/Python from sources you will need:</p>
|
||
<ul class="simple">
|
||
<li><p>C compiler</p></li>
|
||
<li><p>Python development files (Usually they are installed with package <strong>python3-dev</strong>). The minimum supported version of Python is 3.7.</p></li>
|
||
<li><p>MariaDB Connector/C libraries and header files (Either from MariaDB server package or
|
||
from MariaDB Connector/C package). Minimum required version for MariaDB Connector/Python < 1.1.0 is 3.1.5, for later versions 3.3.1.
|
||
If your distribution doesn’t provide a recent version of MariaDB Connector/C you can either download binary packages from <code class="docutils literal notranslate"><span class="pre">MariaDB</span> <span class="pre">Connector</span> <span class="pre">Download</span> <span class="pre">page</span> <span class="pre"><https://mariadb.com/downloads/connectors/></span></code>__ or build
|
||
the package from source.</p></li>
|
||
<li><p>The mariadb_config program from MariaDB Connector/C, which should be in your PATH directory.</p></li>
|
||
<li><p>For Posix systems: TLS libraries, e.g. GnuTLS or OpenSSL (default)</p></li>
|
||
<li><p>Since MariaDB Connector/Python 1.1.5: Python’s “packaging” module.</p></li>
|
||
</ul>
|
||
<p>On Posix systems make sure that the path environment variable contains the directory which
|
||
contains the mariadb_config utility.</p>
|
||
<p>Once everything is in place, run</p>
|
||
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">pip3 install mariadb</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>or if you downloaded the source package</p>
|
||
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">cd source_package_dir</span>
|
||
<span class="go">python3 -m pip install .</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>For troubleshooting please also check the chapter <span class="xref std std-ref">installation_faq</span> from the FAQ page.</p>
|
||
</section>
|
||
</section>
|
||
<section id="test-suite">
|
||
<h2>Test suite<a class="headerlink" href="#test-suite" title="Link to this heading">¶</a></h2>
|
||
<p>If you have installed the sources, after successful build you can run the test suite
|
||
from the source directory.</p>
|
||
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">cd testing</span>
|
||
<span class="go">python3 -m unittest discover -v</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>You can configure the connection parameters by using the following environment variables</p>
|
||
<ul class="simple">
|
||
<li><p>TEST_DB_USER (default root)</p></li>
|
||
<li><p>TEST_DB_PASSWORD</p></li>
|
||
<li><p>TEST_DB_DATABASE (default ‘testp’)</p></li>
|
||
<li><p>TEST_DB_HOST (default ‘localhost’)</p></li>
|
||
<li><p>TEST_DB_PORT (default 3306)</p></li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
||
<div class="sphinxsidebarwrapper">
|
||
<div>
|
||
<h3><a href="index.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">Installation</a><ul>
|
||
<li><a class="reference internal" href="#prerequisites">Prerequisites</a></li>
|
||
<li><a class="reference internal" href="#binary-installation">Binary installation</a><ul>
|
||
<li><a class="reference internal" href="#microsoft-windows">Microsoft Windows</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#installation-from-source">Installation from Source</a><ul>
|
||
<li><a class="reference internal" href="#build-prerequisites">Build prerequisites</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#test-suite">Test suite</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
<div>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="index.html"
|
||
title="previous chapter">MariaDB Connector/Python</a></p>
|
||
</div>
|
||
<div>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="usage.html"
|
||
title="next chapter">Basic usage</a></p>
|
||
</div>
|
||
<search id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</search>
|
||
<script>document.getElementById('searchbox').style.display = "block"</script>
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="usage.html" title="Basic usage"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="index.html" title="MariaDB Connector/Python"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="index.html">MariaDB Connector/Python 1.1.13 documentation</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">Installation</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2019-2025 MariaDB Corporation and Georg Richter.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |