简体   繁体   中英

Python libinsane in Windows

I'm currently trying to have libinsane working on python (2.7 or 3.4) on Windows 10.

Following instruction from official doc ( https://doc.openpaper.work/libinsane/latest/libinsane/install.html ), I've successfully build a 64b version.

But, I'm not familiar with GObject, I don't know where to put DLL and typelib files!

Anyone can help me to understand how to have libinsane working?

At this time, I'm just trying to have the official examples working. ( https://gitlab.gnome.org/World/OpenPaperwork/libinsane/tree/master/subprojects/libinsane-gobject/examples )

Thanks in advance for your help.

I have been able to make the examples to work and here is how.

First of all, make sure you have mysys2 installed.

Follow the installation instructions in the link above.

Following that, run this mingw64.exe in C:\\msys64

run the following commands from the installation guide.

pacman -S \
    make \
    mingw-w64-x86_64-cunit \
    mingw-w64-x86_64-doxygen \
    mingw-w64-x86_64-gcc \
    mingw-w64-x86_64-gobject-introspection \
    mingw-w64-x86_64-meson \
    mingw-w64-x86_64-python3-gobject \
    mingw-w64-x86_64-vala

Then run this:

 git clone https://gitlab.gnome.org/World/OpenPaperwork/libinsane.git
cd libinsane

make PREFIX=/mingw64

and finally

make install

The latter 2 commands must be run inside the libinsane directory. You can the navigation to the example sample projects and run:

python list_device.py 

for listing devices

python scan.py outputfilename.png

for scanning documents

DLL Files In development, you wont need to package the dll files but in production, for any other language other than windows, it will be a requirement.

Unfortunately, they didn't state where to put them. I have opened an issue for that.

Using ProcMon as you suggested has helped to solve my problem, it now works fine!

In case this can help anyone to make libinsane working on Python, you need to put these DLLs at these places:

C:\msys64\mingw64\bin\libsystre-0.dll => <python path>/lib/site-packages/gnome
C:\msys64\mingw64\bin\libtre-5.dll => <python path>/lib/site-packages/gnome
C:\msys64\usr\local\lib\girepository-1.0\Libinsane-1.0.typelib => <python path>/lib/site-packages/gnome/lib/girepository-1.0/
C:\msys64\usr\local\bin\libinsane_gobject.dll => <python path>/lib/site-packages/gnome
C:\msys64\usr\local\bin\libinsane.dll => <python path>/lib/site-packages/gnome

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM