ubuntu14.04环境下python3 Image.show()不显示图片问题
2015-09-18 19:56
561 查看
我使用了python3.4,Pillow2.9。但在使用下面代码时,show()没有动作。from PIL import Image
image = Image.open('captcha.gif')
image.show()
查了好久,才在是stackoverflow上找到解决方法。分两种:
1 安装imagemagick: sudo apt-get install imagemagick。
2 修改Pillow文件:在ImageShow.py(位置在usr/local/lib/python3.4/dist-packages的Pillow-2.9.0~.egg中)代码片段中把"display"替换为"eog"。其中display时imagemagick的命令行启动命令,eog则是系统默认图片查看器的。 class DisplayViewer(UnixViewer):
def get_command_ex(self, file, **options):
command = executable = "display"
return command, executable
if which("display"):
register(DisplayViewer)
两者相比,第一个方法很方便、简单。第二个方法没有成功,因为我无法修改ImageShow.py文件。
参考stackoverflow的热情解答:http://stackoverflow.com/questions/16279441/image-show-wont-display-the-picture
image = Image.open('captcha.gif')
image.show()
查了好久,才在是stackoverflow上找到解决方法。分两种:
1 安装imagemagick: sudo apt-get install imagemagick。
2 修改Pillow文件:在ImageShow.py(位置在usr/local/lib/python3.4/dist-packages的Pillow-2.9.0~.egg中)代码片段中把"display"替换为"eog"。其中display时imagemagick的命令行启动命令,eog则是系统默认图片查看器的。 class DisplayViewer(UnixViewer):
def get_command_ex(self, file, **options):
command = executable = "display"
return command, executable
if which("display"):
register(DisplayViewer)
两者相比,第一个方法很方便、简单。第二个方法没有成功,因为我无法修改ImageShow.py文件。
参考stackoverflow的热情解答:http://stackoverflow.com/questions/16279441/image-show-wont-display-the-picture
相关文章推荐
- Ubuntu 默认壁纸历代记
- Ubuntu Remix Cinnamon 20.04 评测:Ubuntu 与 Cinnamon 的完美融合
- 关于Ubuntu 11.10启动提示waiting for the network configuration的问题
- 在 Ubuntu 桌面中使用文件和文件夹
- Python动态类型的学习---引用的理解
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- ubuntu下chrome无法同步问题解决
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- Ubuntu Linux使用体验
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析