pyodbc module does not work with Python3
<p>I have just transitioned to a Mac (from Win) and I cannot find the proper way to make a script work (it did on Win).</p>

<p>I am using <code>import pyodbc</code> on the first line and I get the "No module .." error.</p>

<p><em>Later Edit</em>: I changed the first line to <code>import pypyodbc</code></p>

<p>If I enter the workspace in the preexistent python version (2.7.10) I can import the module but the script fails with:</p>

<pre><code>pyodbc.Error: ('00000', '[00000] [iODBC][Driver Manager]dlopen({SQL Server}, 6): image not found (0) (SQLDriverConnect)')
</code></pre>

<p>I want to use python3 anyway.</p>

<p>If I enter python3, when trying to import the module I get an error.</p>

<p>My main problem is that I an not sure how to find where the problem is. Can anyone help with this?</p>

<p><strong>Later Edit</strong></p>

<p>It worked if I used <code>pypyodbc</code> instead of <code>pyodbc</code>. It imports the module and the only thing left to solve is the decoding part: <code>UnicodeDecodeError: 'utf-32-le' codec can't decode bytes in position 0-1: truncated data</code></p>

<p>Module pyobdc is distributed for Python3. You can check that on its <a href="https://pypi.python.org/pypi/pyodbc" rel="nofollow">PyPi page</a>.</p>

<p>Did you actually install it for Python3?</p>

<p>Python packages are installed separately for each Python instance on your machine. (In fact, you may even use virtual environments to create multiple environments for one Python installation, which can be useful if you need to run several applications with dependencies on different versions of the same library.)</p>

<p>To install a package using pip for Python3 on a Mac with also Python2 installed, see <a href="http://stackoverflow.com/questions/20082935/how-to-install-pip-for-python3-on-mac-os-x">this question</a>.</p>

<h3>Edit: installation issue</h3>

<p>Your problem seems to be related to <a href="https://github.com/mkleehammer/pyodbc/issues/101" rel="nofollow">this issue</a> in pyodbc.</p>

<p>The fix is in master but not released on Pypi. You may try to install the latest version from master branch.</p>

<p>Should be:</p>

<pre><code>pip install git+https://github.com/mkleehammer/pyodbc@master
</code></pre>

python pyodbc