LeoHsiao1 / pyexiv2

Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile.
GNU General Public License v3.0
197 stars 39 forks source link

something wrong! Could not find module 'C:\Python39\lib\site-packages\pyexiv2\lib\exiv2.dll' #60

Closed logofun closed 3 years ago

logofun commented 3 years ago

image

when I install the module, and then import pyexiv2 , it show wrong(as the above picture)

LeoHsiao1 commented 3 years ago

Could not find exiv2.dll. It could be one of two cases :

Let's check the first case first. Please show what's in your directory:

C:\Python39\Lib\site-packages\pyexiv2\lib
logofun commented 3 years ago

image the file(exiv2.dll) exist in the right way. How to check the problem via the 2rd case. thanks for your respond

LeoHsiao1 commented 3 years ago

Next, Try importing exiv2.dll in the Python interpreter:

>>> import ctypes
>>> ctypes.CDLL(r'C:\Python39\Lib\site-packages\pyexiv2\lib\exiv2.dll')

If it fails, it means exiv2.dll is not compatible with the computer.

logofun commented 3 years ago

image oh no, the same wrong how can I do. My computer is surface pro with the windows10 system.

LeoHsiao1 commented 3 years ago

What kind of Python interpreter do you use? Only CPython supports importing C++ libraries.

>>> import platform
>>> platform.python_implementation()
'CPython'
LeoHsiao1 commented 3 years ago

If you're using CPython and still can't import exiv2.dll, you'll have to compile it yourself. This is a tricky process:

  1. Install Visual Studio to compile exiv2 manually. See the docs of Exiv2.
  2. Copy exiv2.dll to compile pyexiv2. See the docs of pyexiv2.
LeoHsiao1 commented 3 years ago

In addition to compatibility, it could be for other reasons. You can try these: https://iyn.me/i/post-40.html https://stackoverflow.com/questions/59330863/cant-import-dll-module-in-python

logofun commented 3 years ago

It seems that the computer environment is the real reason. because when I use another PC and handle the program as the same way, it shows OK. by the way , I am using CPython in the both computer. Copy exiv2.dll from the github/LeoHsiao1/pyexiv2, it is not working. From the others methods, such as 'os.add_all_directory('....')',it's also wrong How to compile exiv2 manually?

LeoHsiao1 commented 3 years ago

I still think that exiv2.dll should be compatible with your computer, because your computer is not special. Maybe you can try installing Python3.5 and then execute pip install pyexiv2. Finally, you can find the Exiv2 repository on GitHub, which is well documented.

LeoHsiao1 commented 3 years ago

I just tried using pyexiv2 on a newly installed Windows 10, it works:

C:\Users\Leo>python
Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyexiv2
logofun commented 3 years ago

the same version Python, One in the lenovo notebook computer, it's ok, just like your result. the other in Surface pro, it's also wrong

LeoHsiao1 commented 3 years ago

I found the answer. This is because the Windows computer lacks C++ environment. Please try to install Microsoft Visual C++ Redistributable for Visual Studio 2019.

github-actions[bot] commented 2 years ago

This issue has been automatically closed because there has been no activity for a month.