Is there anyway to install twain module in python

2019-07-12 02:58发布

问题:

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?

回答1:

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 .......