[英]from PIL import Image - ImportError: No module named PIL
I know there are a number of questions already on stackoverflow related to this issue and I have read them all, but still I am having no success with this issue.我知道在 stackoverflow 上已经有很多与这个问题相关的问题,我已经阅读了所有问题,但我仍然没有解决这个问题。 I am hoping somebody can help me out with this.
我希望有人能帮我解决这个问题。
I have installed and reinstalled Pillow 10 times now.我现在已经安装并重新安装了 Pillow 10 次。 I have updated my .bash_profile.
我已经更新了我的 .bash_profile。 Still, I get the same error message.
尽管如此,我还是收到了相同的错误消息。
This is my .bash_profile:这是我的 .bash_profile:
export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH="$PATH:/usr/local/bin/"
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
This is my code:这是我的代码:
import sys
import string
import re
from PIL import Image
It chokes on the 4th line every time with the message: ImportError: No module named PIL.它每次都在第 4 行出现消息:ImportError: No module named PIL。 I have also tried replacing the fourth line with
我也试过用
import Image
also with no success.也没有成功。 I know there are many questions similar to this one on here but believe me I have been reading the answers on those with no success so I'm hoping somebody here can help me with my particular situation.
我知道这里有很多与这个问题类似的问题,但相信我,我一直在阅读那些没有成功的问题的答案,所以我希望这里有人可以帮助我解决我的特殊情况。 Thanks!
谢谢!
I was experiencing a similar issue.我遇到了类似的问题。 Fixed it by pip installing WITHOUT sudo.
通过在没有 sudo 的情况下安装 pip 来修复它。
pip install pillow
instead of代替
sudo pip install pillow
I encountered this while installing tensorflow code on NVIDIA Jetson Nano.我在 NVIDIA Jetson Nano 上安装 tensorflow 代码时遇到了这个问题。 This works for me:
这对我有用:
pip3 install Image
First,check pip is the latest version or not.Using pip install -U pip. 首先,检查点是否是最新版本。使用pip install -U pip。 Next,in windows run as the administrator, in linux run as the root.
接下来,在windows中以管理员身份运行,在linux中以root身份运行。 My English is not very good, wish it can help you.
我的英语不是很好,希望它可以帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.