python为什么无法保存图片_无法在python中保存PIL图像

在尝试使用Python的PIL库保存图像时遇到错误,无论指定完整路径还是在Jupyter Notebook中运行,都报'FileNotFoundError'。问题出现在'fp = builtins.open(filename, "w+b")'这行代码,提示没有找到文件或目录。可能是路径格式、权限或文件夹不存在导致的。寻求解决方案。" 122865438,11635798,Express.js session 实战指南,"['服务器开发', 'HTTP', '运维', 'Node.js', 'Web开发']
摘要由CSDN通过智能技术生成

我试图从这里运行代码https://github.com/pytorch/examples/tree/master/fast_neural_style,我从终端python neural_style/neural_style.py eval --content-image ./images/content-images/amber.jpg --model ./saved_models/mosaic.pth --output-image a.jpg --cuda 0运行以下命令,其中a.jpg是输出图像,但每次我都会收到错误:Traceback (most recent call last):

File "neural_style/neural_style.py", line 240, in

main()

File "neural_style/neural_style.py", line 236, in main

stylize(args)

File "neural_style/neural_style.py", line 150, in stylize

utils.save_image(args.output_image, output[0])

File "C:\Users\Lenovo\Documents\fast_neural_style\neural_style\utils.py", line 19, in save_image

img.save(filename)

File "C:\Users\Lenovo\Anaconda3\lib\site-packages\PIL\Image.py", line 1991, in save

fp = builtins.open(filename, "w+b")

FileNotFoundEr

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值