I want to install the Python TWAIN module in Python 3. But in the docs it says:
Python versions 2.1 through 2.5 are supported.
Can I convert it using 2to3
?
I want to install the Python TWAIN module in Python 3. But in the docs it says:
Python versions 2.1 through 2.5 are supported.
Can I convert it using 2to3
?
Use past module which provides an experimental translation package to help with importing and using old Python 2 modules in a Python 3 environment.
So install your package with pip
pip3 install twain --no-compile # to ignore SyntaxErrors
And use next code to import twain in your python3
code :
from past import autotranslate
autotranslate(['twain'])
import twain
# use twain .......
You can install twain
for Python 3 using the .whl
method.
First, you need to download the .whl
file: twainmodule - Python Extension Packages for Windows. Pick the one that matches your Python 3 version (example: I downloaded the twain‑1.0.4‑cp38‑cp38‑win32.whl
).
Important note, I specifically chose the file ending with win32.whl
because I had troubles using the 64-bit version. For example, the scaner I was working with only supported 32-bit Twain.
Then, install wheel
with pip install wheel
.
Install twain using pip install /path/to/twain‑1.0.4‑cpXX‑cpXX‑XX.whl