如何从Jupyter的枕头导入图像?

2024-09-28 21:51:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试从枕头导入图像。在

    from PILLOW import Image
im = Image.open("bride.jpg")
im.rotate(45).show()
Undefined function 'from' for input arguments of type 'char'.

>> import PIL.Image
im = Image.open("bride.jpg")
im.rotate(45).show()
Error using import
Import argument 'PIL.Image' cannot be found or cannot be imported.

Undefined function 'from' for input arguments of type 'char'.

我总是犯同样的错误。我是否使用了错误的导入语句?在

编辑: 我注意到了别的东西。当我浏览我的C:/drive并查看Pip和PIL等所在的文件夹。里面什么都没有。即使当我复制一个文件到那个区域,打开那个新文件,我也看不到里面的任何东西。但当我复制它时,绿色条显示数据正在传输。在

代码: https://hub.gke.mybinder.org/user/alexmill-website_notebooks-fcqkeh7a/notebooks/fourier-spinning-circles.ipynb#

示例:

^{pr2}$

Tags: fromimageimportforinputpilshowfunction
1条回答
网友
1楼 · 发布于 2024-09-28 21:51:09

您的binder不起作用的原因是您的requirements.txt如下所示:

matplotlib==2.0.2
requests==2.20.0
Pillow==5.0.0
numpy==1.13.0
scipy==0.19.0
pandas==0.20.2
scikit-learn==0.18.1
tzlocal-1.5.1

这条线:

tzlocal-1.5.1

可能会破坏绑定依赖项的安装。{a2可能是另一个非常特定的版本。我建议将其更改为:

^{pr2}$

至少在我开始工作的时候。在

在本地,您只需运行pip install -r requirements.txt和管理命令提示符,然后您的本地Jupyter安装应该会自动运行,至少当我将您的笔记本克隆到Windows虚拟机时是这样。在

相关问题 更多 >