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

时间:2020-07-26 10:57:25

标签: python django python-imaging-library synology

我正在尝试将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中运行了它,但没有成功。还尝试多次卸载并安装枕头,但没有成功。

似乎某些依赖关系已损坏,但不知道是哪个。我没办法了。

预先感谢

1 个答案:

答案 0 :(得分:0)

首先,尝试卸载所有内容。

SELECT
a.car_id,a.car_name,
(SELECT status,date_status FROM incident WHERE status= 'arrive') AS arrive,
(SELECT status,date_status FROM incident WHERE status= 'repairs') AS repairs,
(SELECT status,date_status FROM incident WHERE status= 'finish') AS finish,
FROM car a
LEFT OUTER JOIN incident b ON a.car_id = b.car_id
WHERE b.date_created BETWEEN '2020-07-27' AND '2020-07-28';

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

pip uninstall PIL
pip uninstall Pillow

然后安装“实际”枕头:

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

Reference