枕头无法在Synology Nas上导入图像

2024-04-25 06:36:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试运行一个django网站作为个人项目

在Windows中运行良好,所以我尝试在我的Synology DS916+上测试它。我已成功安装此:

Python 3.8.3

Django 3.0.7

枕头7.2

但当我运行python manage.py runserver时,它会返回以下结果:

File "/volume1/WEBMI/webmi/lib/python3.8/site-packages/PIL/Image.py", line 93, in <module>
from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/volume1/WEBMI/webmi/lib/python3.8/site-packages/PIL/__init__.py)

这是Image.py的一部分

try:
    # If the _imaging C module is not present, Pillow will not load.
    # Note that other modules should not refer to _imaging directly;
    # import Image and use the Image.core variable instead.
    # Also note that Image.core is not a publicly documented interface,
    # and should be considered private and subject to change.
    from . import _imaging as core 

    if __version__ != getattr(core, "PILLOW_VERSION", None):
        raise ImportError(
            "The _imaging extension was built for another version of Pillow or PIL:\n"
            "Core version: %s\n"
            "Pillow version: %s" % (getattr(core, "PILLOW_VERSION", None), __version__)
        )

except ImportError as v:
    core = deferred_error(ImportError("The _imaging C module is not installed."))
    # Explanations for ways that we know we might have an import error
    if str(v).startswith("Module use of python"):
        # The _imaging C module is present, but not compiled for
        # the right version (windows only).  Print a warning, if
        # possible.
        warnings.warn(
            "The _imaging extension was built for another version of Python.",
            RuntimeWarning,
        )
    elif str(v).startswith("The _imaging extension"):
        warnings.warn(str(v), RuntimeWarning)
    # Fail here anyway. Don't let people run with a mostly broken Pillow.
    # see docs/porting.rst
    raise

正如你所看到的,我也在virtualenv中运行了它,但没有成功。还多次尝试卸载和安装枕头,但均未成功

似乎有些依赖关系被打破了,但不知道是哪个。我没有主意了

提前谢谢


Tags: thefrompycoreimageimportforpil
1条回答
网友
1楼 · 发布于 2024-04-25 06:36:29

首先,尝试卸载所有内容

pip uninstall PIL
pip uninstall Pillow

接下来,您应该安装PIL,而不是枕头

pip install  no-index -f https://dist.plone.org/thirdparty/ -U PIL

然后安装“实际”枕头:

pip install Pillow

Reference

相关问题 更多 >