在Ubuntu上运行sherloq时遇到错误:ImportError: Cannot import name 'convert_dict_qtables' from 'PIL.JpegImagePlugin'

问题描述 投票:0回答:1

我在尝试在 Ubuntu 上运行 Sherloq 时遇到问题,希望获得一些解决该问题的指导。详情如下:

我已经设置了一个虚拟环境并从 GitHub 克隆了 Sherloq 存储库。当尝试执行 sherloq.py 脚本时,我遇到以下错误:

(sq) ubuntu@ubuntu:~/Documents/GitHub/sherloq/gui$ python sherloq.py
WARNING:tensorflow:From /home/ubuntu/.virtualenvs/sq/lib/python3.10/site-packages/tensorflow/python/compat/v2_compat.py:107: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
Traceback (most recent call last):
  File "/home/ubuntu/Documents/GitHub/sherloq/gui/sherloq.py", line 34, in <module>
    from splicing import SplicingWidget
  File "/home/ubuntu/Documents/GitHub/sherloq/gui/splicing.py", line 13, in <module>
    from noiseprint.noiseprint_blind import genMappUint8
  File "/home/ubuntu/Documents/GitHub/sherloq/gui/noiseprint/noiseprint_blind.py", line 18, in <module>
    from .utility.utilityRead import resizeMapWithPadding
  File "/home/ubuntu/Documents/GitHub/sherloq/gui/noiseprint/utility/utilityRead.py", line 13, in <module>
    from PIL.JpegImagePlugin import convert_dict_qtables
ImportError: cannot import name 'convert_dict_qtables' from 'PIL.JpegImagePlugin' (/home/ubuntu/.virtualenvs/sq/lib/python3.10/site-packages/PIL/JpegImagePlugin.py)

此错误似乎与 Pillow 库有关,特别是与 Convert_dict_qtables 函数有关。

还有其他人遇到过与 Sherloq 类似的问题吗?任何有关如何解决此错误的见解或建议将不胜感激。谢谢!

我尝试执行以下命令,但似乎没有解决方案。

pip install Pillow --upgrade

还可以尝试卸载并重新安装 Pillow 软件包:

pip uninstall Pillow
pip install Pillow

pip install Pillow
的输出为:

(sq) ubuntu@ubuntu:~/Documents/GitHub/sherloq/gui$ pip install Pillow
Collecting Pillow
  Obtaining dependency information for Pillow from https://files.pythonhosted.org/packages/7a/07/e896b096a77375e78e02ce222ae4fd6014928cd76c691d312060a1645dfa/Pillow-10.0.1-cp310-cp310-manylinux_2_28_x86_64.whl.metadata
  Using cached Pillow-10.0.1-cp310-cp310-manylinux_2_28_x86_64.whl.metadata (9.5 kB)
Using cached Pillow-10.0.1-cp310-cp310-manylinux_2_28_x86_64.whl (3.6 MB)
Installing collected packages: Pillow
Successfully installed Pillow-10.0.1

ubuntu python-imaging-library virtualenv importerror
1个回答
0
投票

https://pillow.readthedocs.io/en/stable/releasenotes/8.3.0.html

convert_dict_qtables
方法不再对给定的数据执行任何操作,已被弃用并将在 Pillow 10.0.0 中被删除

安装早期版本:

pip install -U "Pillow < 8.3"
© www.soinside.com 2019 - 2024. All rights reserved.