- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Windows 10 pro 上,我正在运行安装了 python 和 jupyter 的 docker 镜像。我可以启动 docker 镜像,然后从该 shell 启动 jupyter 笔记本。 python2 和 python3 内核均可用。 PIL 和 Pillow 已安装,但我无法导入它们。见下文:
(我用双星号指示了每个 jupyter 单元格的内容。
每个单元格的结果简单地跟随在其下方)
**!pip install Image**
Requirement already satisfied: Image in /usr/local/lib/python3.6/dist-packages (1.5.27)
Requirement already satisfied: pillow in /usr/lib/python3/dist-packages (from Image) (5.1.0)
Requirement already satisfied: django in /usr/local/lib/python3.6/dist-packages (from Image) (2.2)
Requirement already satisfied: sqlparse in /usr/local/lib/python3.6/dist-packages (from django->Image) (0.3.0)
Requirement already satisfied: pytz in /usr/lib/python3/dist-packages (from django->Image) (2018.3)
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
**!pip install Pillow**
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (5.1.0)
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
**!python -m pip install pillow**
Requirement already satisfied: pillow in /usr/lib/python3/dist-packages (5.1.0)
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
**import PIL**
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-70d569469e06> in <module>()
----> 1 import PIL
ImportError: No module named PIL
**import PIL.Image**
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-8-df3f6661ddbf> in <module>()
----> 1 import PIL.Image
ImportError: No module named PIL.Image
**import pillow**
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-11-e32915389b2c> in <module>()
----> 1 import pillow
ImportError: No module named pillow
但是当我退出笔记本并在正在运行的 docker 容器中启动交互式 python session 时,很容易找到 PIL:
root@7092fc2336d3:/# python
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
>>>
最佳答案
这很奇怪。事实证明,jupyter 中的 pip 安装在 python3 站点包中,但 jupyter 笔记本中的 python 正在 python2 站点包中查找。所以当我像这样在 jupyter 单元中安装枕头时
!/usr/bin/python2.7 -m pip install Pillow
现在可以了
import PIL.Image
关于python - 没有名为 Pillow 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55908229/
我正在用 Django 开发一个图片 uploader 。图片上传并保存到磁盘后,我正在尝试调整已保存图像的大小,同时保持其纵横比。我正在使用 Pillow 进行图像处理/调整大小。当我尝试调整图像大
我安装了 Pillow 包: python -m pip install pillow 得到成功消息(成功安装枕头)。关闭并重新打开终端。 但是当我尝试: import pillow 我收到错误消息:
当我运行 python manage.py runserver ,一切开始都很好,但后来我得到一个 SystemCheckError说明 Pillow 未安装;但是,这台机器上肯定安装了 Pillow
这个问题可能已经被问过好几次了,但我无法解决这个错误。我的 M1 Mac 上安装了 pillow、imageio 和其他库。但是,当我在代码下方运行时,仍然出现错误。 注意:我使用 miniforge
我正在遵循这个 SageMaker 指南并使用 1.12 cpu docker 文件。 https://github.com/aws/sagemaker-tensorflow-serving-cont
前言 Pillow作为一个图片模块。可谓是真的简便强大,它的前身是PIL,后来将他取代,现在的pillow 可谓是一家独大,好了,让我们来看看他的具体用法。 今天我们介绍pi
我想对 png 图像进行二值化。如果可能的话,我想使用 Pillow。我见过两种使用方法: image_file = Image.open("convert_image.png") # open co
我正在尝试使用 Pillow 为一些乌尔都语文本生成图像。使用相同的代码生成普通英语就像一个魅力,但当我对乌尔都语文本做同样的事情时,事情就不会那么顺利了。 以下是使用英语完成的代码和结果: from
美好的一天。 在我的工作中,有时我必须使用脚本从数字或 ID 中获取一些信息。就像下面的例子: 我使用的脚本: $sh script.sh 9999999999999 abc 出现在屏幕上的信息
我正在使用 Pillow 3.1.1 图像库和 Python 3.5.1。 我正在尝试使用 Pillow 在图像上绘制字体。但结果看起来绝对丑陋且 Not Acceptable 。 第一个例子:看起来
我希望给定目录中的所有图片都具有相同的大小。这就是我所拥有的: import PIL import os import math from PIL import Image dirPath = r"C
我正在尝试在我的服务器上重新安装 Pillow,我得到了这个: ... Proceed (y/n)? y Successfully uninstalled Pillow-4.0.0 (myproj
为什么我可以使用 ImageGrab.grab(300,200,400,150) 而不是这个:ImageGrab.grab(bbox)? 代码和错误消息: def wl(wx,wy): loc
我正在尝试使用pillow (pil) 来降低图像的文件大小,但是降低图像质量并不会降低保存图像的大小。保存的图像“image2”和“image3”大小相同。 import PIL from Imag
我需要沿着一条线获取像素值,我使用的是 Python3 和 Pillow。在 opencv 中有这样的东西 LineIterator这将返回两点之间所有适当的像素,但我在 Pillow 的文档中没有找
我有一张图片,我想将它转置 30 度。是否可以使用类似的东西 spinPicture003 = Picture003.transpose(Image.Rotate_30) 最佳答案 要绕其中心逆时针
opencv > pil ? 1
Image 对象有一些常用的基本属性,这些属性能够帮助我们了解图片的基本信息,下面对这些属性做简单的讲解: 1) size:查看图像的尺寸 from PIL import Image im = Im
我运行了以下命令将项目依赖项安装到 virtualenv novacek 中: (novacek) $ pip install -r reqs.txt reqs.txt 看起来像这样: Django=
我可以使用以下代码在基本图像上绘制黑色 strip (或矩形): base_width, base_height = img.size background = Image.new('RGBA', (
我是一名优秀的程序员,十分优秀!