无法在manim Linux(Ubuntu)中从“ PIL”导入名称“ _imaging”

时间:2020-05-30 11:37:04

标签: python python-3.x linux manim

soutrik@soutrik-X541UJ:~/manim-folder/manim$ python3.7 -m manim example_scenes.py SquareToCircle -pl
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/soutrik/manim-folder/manim/manim.py", line 2, in <module>
    import manimlib
  File "/home/soutrik/manim-folder/manim/manimlib/__init__.py", line 4, in <module>
    import manimlib.extract_scene
  File "/home/soutrik/manim-folder/manim/manimlib/extract_scene.py", line 9, in <module>
    from manimlib.scene.scene import Scene
  File "/home/soutrik/manim-folder/manim/manimlib/scene/scene.py", line 11, in <module>
    from manimlib.camera.camera import Camera
  File "/home/soutrik/manim-folder/manim/manimlib/camera/camera.py", line 7, in <module>
    from PIL import Image
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 69, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/__init__.py)


所以我尝试打开camera.py并将PIL更改为枕头,然后显示此

soutrik@soutrik-X541UJ:~/manim-folder/manim$ python3.7 -m manim example_scenes.py SquareToCircle -pl
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/soutrik/manim-folder/manim/manim.py", line 2, in <module>
    import manimlib
  File "/home/soutrik/manim-folder/manim/manimlib/__init__.py", line 4, in <module>
    import manimlib.extract_scene
  File "/home/soutrik/manim-folder/manim/manimlib/extract_scene.py", line 9, in <module>
    from manimlib.scene.scene import Scene
  File "/home/soutrik/manim-folder/manim/manimlib/scene/scene.py", line 11, in <module>
    from manimlib.camera.camera import Camera
  File "/home/soutrik/manim-folder/manim/manimlib/camera/camera.py", line 7, in <module>
    from pillow import Image
ModuleNotFoundError: No module named 'pillow'

所以没有模块吧?但是如果我做python3.7 -m pip install pillow我会得到

soutrik@soutrik-X541UJ:~/manim-folder/manim$ python3.7 -m pip install pillow
Requirement already satisfied: pillow in /usr/lib/python3/dist-packages (7.0.0)

我也尝试过枕头

soutrik@soutrik-X541UJ:~/manim-folder/manim$ python3.7 -m pip install Pillow
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (7.0.0)

那么我如何将其安装在此manim文件夹中?还是我不需要这样做?我是否需要在$ PATH中添加一些内容?我对Linux相对较新,但是即使在Windows中,我也不是很了解PATH,只是向它添加了python3.7以从任何地方访问,但是在linux中,我可以从任何地方访问python,而无需将addidn添加到path(它会自动添加到path)吗?可能是因为枕头无法添加到路径,因为我无法从manims文件夹中使用枕头

我也尝试安装PIL

soutrik@soutrik-X541UJ:~/manim-folder/manim$ python3.7 -m pip install PIL
ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: No matching distribution found for PIL

--------------------- EDIT-1 ----------------------- --- 当在主目录中并且我运行时 >>>from PIL import Image

我明白了

>>> from PIL import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 69, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/__init__.py)

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,这样做可以解决我的问题

pip install -U Pillow