当我像这样使用qrcode模块时:
import qrcode
hello = qrcode.make("hello")
type(hello)
hello.save("test.png")我得到了这些错误,但无法解决:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/qrcode/image/pil.py", line 5, in <module>
from PIL import Image, ImageDraw
ModuleNotFoundError: No module named 'PIL'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/data/com.termux/files/home/./py", line 5, in <module>
hello = qrcode.make("hello")
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/qrcode/main.py", line 13, in make
return qr.make_image()
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/qrcode/main.py", line 296, in make_image
from qrcode.image.pil import PilImage
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/qrcode/image/pil.py", line 7, in <module>
import Image
ModuleNotFoundError: No module named 'Image'我正在使用python 3.10
发布于 2022-05-06 05:53:47
您可以(重新)安装QR代码生成器Python包,该包包括用于生成图像的Pillow包:
pip install qrcode[pil]若要单独安装包含Pillow类的Image包,请执行以下操作:
pip install Pillow https://stackoverflow.com/questions/72136100
复制相似问题