代码之家  ›  专栏  ›  技术社区  ›  Ramadhan Arif Hardijansyah

在Ubuntu上运行sherloq时遇到错误:ImportError:无法从“PIL.JpegImagePlugin”导入名称“convert_dict_qtables”

  •  1
  • Ramadhan Arif Hardijansyah  · 技术社区  · 2 年前

    我在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
    
    
    1 回复  |  直到 2 年前
        1
  •  0
  •   phd    2 年前

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

    convert_dict_qtables 方法不再对提供给它的数据执行任何操作,已被弃用,并且将 已在枕头10.0.0中删除

    安装早期版本:

    pip install -U "Pillow < 8.3"