我正在尝试使用'qrcode'库创建QRCode。 但是,当我尝试制作图像时,出现以下错误:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\qrcode\image\pil.py", line 6, in <module>
from PIL import Image, ImageDraw
ImportError: No module named 'PIL'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Floris/Documents/GitHub/MiniProject-GroepV1L/TEST_QR.py", line 4, in <module>
img = qrcode.make(string)
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\qrcode\main.py", line 11, in make
return qr.make_image()
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\qrcode\main.py", line 256, in make_image
from qrcode.image.pil import PilImage
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\qrcode\image\pil.py", line 8, in <module>
import Image
ImportError: No module named 'Image'
我现在的代码是:
import qrcode
string = "This is a test string for StackOverflow"
img = qrcode.make(string)
答案 0 :(得分:2)
你必须安装Pillow:
pip install pillow
可能还有其他一些依赖项。
您应该使用pip安装 qrcode 包,以便安装依赖项。