[Python] I tried importing ImageEnhance from PIL but got an OSERROR, How do I correct this?

Discussão em 'Python' iniciado por Stack, Agosto 14, 2025.

  1. Stack

    Stack Membro Participativo

    The code:

    from PIL import ImageEnhance


    gave this error :-

    OSError Traceback (most recent call last)
    <ipython-input-24-84203ab35a9e> in <module>
    ----> 1 from PIL import ImageEnhance

    ~\Anaconda3\envs\py3env\lib\site-packages\PIL\ImageEnhance.py in <module>
    19 #
    20
    ---> 21 from . import Image, ImageFilter, ImageStat
    22
    23

    ~\Anaconda3\envs\py3env\lib\site-packages\PIL\ImageFilter.py in <module>
    21
    22 try:
    ---> 23 import numpy
    24 except ImportError: # pragma: no cover
    25 numpy = None

    ~\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py in <module>
    140 from . import _distributor_init
    141
    --> 142 from . import core
    143 from .core import *
    144 from . import compat

    ~\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py in <module>
    21 # NOTE: would it change behavior to load ALL
    22 # DLLs at this path vs. the name restriction?
    ---> 23 WinDLL(os.path.abspath(filename))
    24 DLL_filenames.append(filename)
    25 if len(DLL_filenames) > 1:

    ~\Anaconda3\envs\py3env\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno,
    use_last_error)
    354
    355 if handle is None:
    --> 356 self._handle = _dlopen(self._name, mode)
    357 else:
    358 self._handle = handle

    OSError: [WinError 193] %1 is not a valid Win32 application

    Continue reading...

Compartilhe esta Página