{"id":1134575,"date":"2025-01-08T21:16:55","date_gmt":"2025-01-08T13:16:55","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1134575.html"},"modified":"2025-01-08T21:16:57","modified_gmt":"2025-01-08T13:16:57","slug":"python%e5%a6%82%e4%bd%95%e8%87%aa%e5%88%b6%e5%8a%a8%e6%80%81%e4%ba%8c%e7%bb%b4%e7%a0%81","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1134575.html","title":{"rendered":"python\u5982\u4f55\u81ea\u5236\u52a8\u6001\u4e8c\u7ef4\u7801"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25103501\/fc19521b-8d86-4454-9587-a2fcf5a60fe0.webp\" alt=\"python\u5982\u4f55\u81ea\u5236\u52a8\u6001\u4e8c\u7ef4\u7801\" \/><\/p>\n<p><p> <strong>Python\u5982\u4f55\u81ea\u5236\u52a8\u6001\u4e8c\u7ef4\u7801<\/strong><\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528Python\u81ea\u5236\u52a8\u6001\u4e8c\u7ef4\u7801\u9700\u8981\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a\u751f\u6210\u9759\u6001\u4e8c\u7ef4\u7801\u3001\u5c06\u591a\u4e2a\u4e8c\u7ef4\u7801\u6574\u5408\u6210\u52a8\u56fe\u3001\u5229\u7528\u56fe\u50cf\u5904\u7406\u5e93\u8fdb\u884c\u4f18\u5316\u3002\u8fd9\u4e9b\u6b65\u9aa4\u5177\u4f53\u5b9e\u73b0\u8d77\u6765\u867d\u7136\u6d89\u53ca\u591a\u4e2a\u5e93\u548c\u7ec6\u8282\uff0c\u4f46\u901a\u8fc7\u5408\u7406\u7684\u5de5\u5177\u548c\u6280\u5de7\u53ef\u4ee5\u7b80\u5316\u6d41\u7a0b\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5b9e\u73b0\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u5e76\u5206\u4eab\u4e00\u4e9b\u5b9e\u9645\u64cd\u4f5c\u4e2d\u7684\u6ce8\u610f\u4e8b\u9879\u548c\u4f18\u5316\u65b9\u6cd5\u3002<\/strong><\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u751f\u6210\u9759\u6001\u4e8c\u7ef4\u7801<\/h3>\n<\/p>\n<p><p>\u5728\u751f\u6210\u52a8\u6001\u4e8c\u7ef4\u7801\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u751f\u6210\u591a\u4e2a\u9759\u6001\u4e8c\u7ef4\u7801\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Python\u7684<code>qrcode<\/code>\u5e93\u6765\u751f\u6210\u9759\u6001\u4e8c\u7ef4\u7801\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u5fc5\u8981\u7684\u5e93<\/h4>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install qrcode[pil]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u751f\u6210\u9759\u6001\u4e8c\u7ef4\u7801<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>qrcode<\/code>\u5e93\u751f\u6210\u9759\u6001\u4e8c\u7ef4\u7801\u975e\u5e38\u7b80\u5355\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import qrcode<\/p>\n<h2><strong>\u6570\u636e<\/strong><\/h2>\n<p>data = &quot;https:\/\/example.com&quot;<\/p>\n<h2><strong>\u751f\u6210\u4e8c\u7ef4\u7801<\/strong><\/h2>\n<p>qr = qrcode.QRCode(<\/p>\n<p>    version=1,<\/p>\n<p>    error_correction=qrcode.constants.ERROR_CORRECT_L,<\/p>\n<p>    box_size=10,<\/p>\n<p>    border=4,<\/p>\n<p>)<\/p>\n<p>qr.add_data(data)<\/p>\n<p>qr.make(fit=True)<\/p>\n<h2><strong>\u521b\u5efa\u56fe\u50cf<\/strong><\/h2>\n<p>img = qr.make_image(fill_color=&quot;black&quot;, back_color=&quot;white&quot;)<\/p>\n<h2><strong>\u4fdd\u5b58\u56fe\u50cf<\/strong><\/h2>\n<p>img.save(&quot;static_qr.png&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u5faa\u73af\u548c\u52a8\u6001\u6570\u636e\uff0c\u6211\u4eec\u53ef\u4ee5\u751f\u6210\u591a\u4e2a\u9759\u6001\u4e8c\u7ef4\u7801\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u5c06\u591a\u4e2a\u4e8c\u7ef4\u7801\u6574\u5408\u6210\u52a8\u56fe<\/h3>\n<\/p>\n<p><p>\u751f\u6210\u591a\u4e2a\u9759\u6001\u4e8c\u7ef4\u7801\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Python\u7684<code>Pillow<\/code>\u5e93\u5c06\u8fd9\u4e9b\u56fe\u50cf\u5408\u6210\u4e3aGIF\u52a8\u56fe\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5Pillow\u5e93<\/h4>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pillow<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u5c06\u9759\u6001\u4e8c\u7ef4\u7801\u6574\u5408\u6210\u52a8\u56fe<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u5c06\u591a\u4e2a\u4e8c\u7ef4\u7801\u56fe\u50cf\u5408\u6210\u4e3a\u52a8\u56fe\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from PIL import Image<\/p>\n<h2><strong>\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u7cfb\u5217\u7684\u4e8c\u7ef4\u7801\u56fe\u50cf\u6587\u4ef6<\/strong><\/h2>\n<p>image_files = [&quot;qr1.png&quot;, &quot;qr2.png&quot;, &quot;qr3.png&quot;, &quot;qr4.png&quot;]<\/p>\n<h2><strong>\u6253\u5f00\u56fe\u50cf\u6587\u4ef6<\/strong><\/h2>\n<p>images = [Image.open(image) for image in image_files]<\/p>\n<h2><strong>\u4fdd\u5b58\u4e3aGIF\u52a8\u56fe<\/strong><\/h2>\n<p>images[0].save(&quot;dynamic_qr.gif&quot;, save_all=True, append_images=images[1:], duration=500, loop=0)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u5229\u7528\u56fe\u50cf\u5904\u7406\u5e93\u8fdb\u884c\u4f18\u5316<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u4f7f\u751f\u6210\u7684\u52a8\u56fe\u66f4\u52a0\u7f8e\u89c2\u548c\u5b9e\u7528\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u56fe\u50cf\u5904\u7406\u6280\u672f\u8fdb\u884c\u4f18\u5316\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u8c03\u6574\u6bcf\u5e27\u7684\u5927\u5c0f\u3001\u989c\u8272\u548c\u8fb9\u6846\u3002<\/p>\n<\/p>\n<p><h4>1. \u8c03\u6574\u5927\u5c0f<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u8c03\u6574\u6bcf\u5e27\u56fe\u50cf\u7684\u5927\u5c0f\uff0c\u53ef\u4ee5\u4f7f\u52a8\u56fe\u5728\u4e0d\u540c\u8bbe\u5907\u4e0a\u66f4\u597d\u5730\u663e\u793a\u3002\u4ee5\u4e0b\u662f\u8c03\u6574\u5927\u5c0f\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">resized_images = [image.resize((200, 200), Image.ANTIALIAS) for image in images]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u8c03\u6574\u989c\u8272\u548c\u8fb9\u6846<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528Pillow\u5e93\u4e2d\u7684\u56fe\u50cf\u5904\u7406\u529f\u80fd\u6765\u8c03\u6574\u989c\u8272\u548c\u8fb9\u6846\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">for image in images:<\/p>\n<p>    # \u8f6c\u6362\u4e3aRGB\u6a21\u5f0f<\/p>\n<p>    image = image.convert(&quot;RGB&quot;)<\/p>\n<p>    # \u6dfb\u52a0\u8fb9\u6846<\/p>\n<p>    border_color = (255, 0, 0)  # \u7ea2\u8272<\/p>\n<p>    border_width = 10<\/p>\n<p>    new_image = Image.new(&quot;RGB&quot;, (image.width + 2 * border_width, image.height + 2 * border_width), border_color)<\/p>\n<p>    new_image.paste(image, (border_width, border_width))<\/p>\n<p>    # \u66ff\u6362\u539f\u56fe\u50cf<\/p>\n<p>    images[images.index(image)] = new_image<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u751f\u6210\u548c\u4f18\u5316\u52a8\u6001\u4e8c\u7ef4\u7801\u7684\u6ce8\u610f\u4e8b\u9879<\/h3>\n<\/p>\n<p><p>\u5728\u751f\u6210\u548c\u4f18\u5316\u52a8\u6001\u4e8c\u7ef4\u7801\u65f6\uff0c\u6709\u51e0\u4e2a\u5173\u952e\u70b9\u9700\u8981\u6ce8\u610f\uff1a<\/p>\n<\/p>\n<p><h4>1. \u6570\u636e\u91cf<\/h4>\n<\/p>\n<p><p>\u52a8\u6001\u4e8c\u7ef4\u7801\u7684\u6bcf\u4e00\u5e27\u90fd\u5305\u542b\u4e0d\u540c\u7684\u6570\u636e\uff0c\u56e0\u6b64\u751f\u6210\u7684\u52a8\u56fe\u53ef\u80fd\u4f1a\u6bd4\u8f83\u5927\u3002\u4e3a\u4e86\u4fdd\u8bc1\u4e8c\u7ef4\u7801\u7684\u8bc6\u522b\u7387\uff0c\u5efa\u8bae\u63a7\u5236\u6bcf\u5e27\u6570\u636e\u7684\u5927\u5c0f\u3002<\/p>\n<\/p>\n<p><h4>2. \u52a8\u56fe\u65f6\u957f\u548c\u5e27\u6570<\/h4>\n<\/p>\n<p><p>\u52a8\u56fe\u7684\u65f6\u957f\u548c\u5e27\u6570\u4f1a\u76f4\u63a5\u5f71\u54cd\u6587\u4ef6\u5927\u5c0f\u548c\u52a0\u8f7d\u901f\u5ea6\u3002\u5efa\u8bae\u6839\u636e\u5b9e\u9645\u9700\u6c42\u8c03\u6574\u52a8\u56fe\u7684\u5e27\u6570\u548c\u6bcf\u5e27\u7684\u663e\u793a\u65f6\u957f\u3002<\/p>\n<\/p>\n<p><h4>3. \u517c\u5bb9\u6027<\/h4>\n<\/p>\n<p><p>\u4e0d\u540c\u7684\u8bbe\u5907\u548c\u8f6f\u4ef6\u5bf9GIF\u52a8\u56fe\u7684\u652f\u6301\u7a0b\u5ea6\u4e0d\u540c\u3002\u5728\u751f\u6210\u52a8\u56fe\u524d\uff0c\u53ef\u4ee5\u5148\u6d4b\u8bd5\u4e00\u4e0b\u5728\u76ee\u6807\u8bbe\u5907\u4e0a\u7684\u663e\u793a\u6548\u679c\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u5b9e\u9645\u5e94\u7528\u4e2d\u7684\u4f18\u5316\u548c\u6280\u5de7<\/h3>\n<\/p>\n<p><h4>1. \u4f7f\u7528\u7f13\u5b58\u63d0\u9ad8\u6548\u7387<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u9891\u7e41\u751f\u6210\u52a8\u6001\u4e8c\u7ef4\u7801\uff0c\u53ef\u4ee5\u4f7f\u7528\u7f13\u5b58\u6280\u672f\u63d0\u9ad8\u6548\u7387\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u7f13\u5b58\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>from hashlib import md5<\/p>\n<p>def generate_qr(data):<\/p>\n<p>    # \u751f\u6210\u6570\u636e\u7684\u54c8\u5e0c\u503c<\/p>\n<p>    hash_value = md5(data.encode()).hexdigest()<\/p>\n<p>    cache_file = f&quot;{hash_value}.png&quot;<\/p>\n<p>    # \u5982\u679c\u7f13\u5b58\u6587\u4ef6\u5b58\u5728\uff0c\u5219\u76f4\u63a5\u8bfb\u53d6<\/p>\n<p>    if os.path.exists(cache_file):<\/p>\n<p>        return Image.open(cache_file)<\/p>\n<p>    # \u5426\u5219\u751f\u6210\u65b0\u7684\u4e8c\u7ef4\u7801<\/p>\n<p>    qr = qrcode.QRCode(<\/p>\n<p>        version=1,<\/p>\n<p>        error_correction=qrcode.constants.ERROR_CORRECT_L,<\/p>\n<p>        box_size=10,<\/p>\n<p>        border=4,<\/p>\n<p>    )<\/p>\n<p>    qr.add_data(data)<\/p>\n<p>    qr.make(fit=True)<\/p>\n<p>    img = qr.make_image(fill_color=&quot;black&quot;, back_color=&quot;white&quot;)<\/p>\n<p>    img.save(cache_file)<\/p>\n<p>    return img<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4f7f\u7528\u5e76\u884c\u5904\u7406\u52a0\u901f\u751f\u6210<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u751f\u6210\u5927\u91cf\u7684\u4e8c\u7ef4\u7801\uff0c\u53ef\u4ee5\u4f7f\u7528\u5e76\u884c\u5904\u7406\u6280\u672f\u52a0\u901f\u751f\u6210\u8fc7\u7a0b\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5e76\u884c\u5904\u7406\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from concurrent.futures import ThreadPoolExecutor<\/p>\n<p>def generate_qr_parallel(data_list):<\/p>\n<p>    with ThreadPoolExecutor(max_workers=4) as executor:<\/p>\n<p>        results = list(executor.map(generate_qr, data_list))<\/p>\n<p>    return results<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u52a8\u6001\u5185\u5bb9\u7684\u9009\u62e9\u548c\u4f18\u5316<\/h4>\n<\/p>\n<p><p>\u9009\u62e9\u5408\u9002\u7684\u52a8\u6001\u5185\u5bb9\u53ef\u4ee5\u63d0\u9ad8\u4e8c\u7ef4\u7801\u7684\u5b9e\u7528\u6027\u548c\u7f8e\u89c2\u5ea6\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5c06\u52a8\u6001\u5185\u5bb9\u8bbe\u7f6e\u4e3a\u5b9e\u65f6\u53d8\u5316\u7684\u6587\u672c\u3001\u56fe\u50cf\u6216\u8005\u5176\u4ed6\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5b9e\u4f8b\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u5b9e\u4f8b\u4ee3\u7801\uff0c\u5c55\u793a\u5982\u4f55\u751f\u6210\u548c\u4f18\u5316\u52a8\u6001\u4e8c\u7ef4\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import qrcode<\/p>\n<p>from PIL import Image<\/p>\n<p>import os<\/p>\n<p>from hashlib import md5<\/p>\n<p>from concurrent.futures import ThreadPoolExecutor<\/p>\n<h2><strong>\u751f\u6210\u4e8c\u7ef4\u7801\u5e76\u7f13\u5b58<\/strong><\/h2>\n<p>def generate_qr(data):<\/p>\n<p>    hash_value = md5(data.encode()).hexdigest()<\/p>\n<p>    cache_file = f&quot;{hash_value}.png&quot;<\/p>\n<p>    if os.path.exists(cache_file):<\/p>\n<p>        return Image.open(cache_file)<\/p>\n<p>    qr = qrcode.QRCode(<\/p>\n<p>        version=1,<\/p>\n<p>        error_correction=qrcode.constants.ERROR_CORRECT_L,<\/p>\n<p>        box_size=10,<\/p>\n<p>        border=4,<\/p>\n<p>    )<\/p>\n<p>    qr.add_data(data)<\/p>\n<p>    qr.make(fit=True)<\/p>\n<p>    img = qr.make_image(fill_color=&quot;black&quot;, back_color=&quot;white&quot;)<\/p>\n<p>    img.save(cache_file)<\/p>\n<p>    return img<\/p>\n<h2><strong>\u5e76\u884c\u751f\u6210\u4e8c\u7ef4\u7801<\/strong><\/h2>\n<p>def generate_qr_parallel(data_list):<\/p>\n<p>    with ThreadPoolExecutor(max_workers=4) as executor:<\/p>\n<p>        results = list(executor.map(generate_qr, data_list))<\/p>\n<p>    return results<\/p>\n<h2><strong>\u751f\u6210\u52a8\u6001\u4e8c\u7ef4\u7801<\/strong><\/h2>\n<p>def create_dynamic_qr(data_list, output_file):<\/p>\n<p>    images = generate_qr_parallel(data_list)<\/p>\n<p>    images[0].save(output_file, save_all=True, append_images=images[1:], duration=500, loop=0)<\/p>\n<h2><strong>\u793a\u4f8b\u6570\u636e<\/strong><\/h2>\n<p>data_list = [&quot;https:\/\/example.com\/page1&quot;, &quot;https:\/\/example.com\/page2&quot;, &quot;https:\/\/example.com\/page3&quot;]<\/p>\n<h2><strong>\u751f\u6210\u52a8\u6001\u4e8c\u7ef4\u7801<\/strong><\/h2>\n<p>create_dynamic_qr(data_list, &quot;dynamic_qr.gif&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\u548c\u4ee3\u7801\u793a\u4f8b\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Python\u751f\u6210\u548c\u4f18\u5316\u52a8\u6001\u4e8c\u7ef4\u7801\u3002\u672c\u6587\u4ecb\u7ecd\u7684\u6280\u672f\u548c\u6280\u5de7\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u6c42\u8fdb\u884c\u8c03\u6574\u548c\u6269\u5c55\uff0c\u4ee5\u6ee1\u8db3\u4e0d\u540c\u573a\u666f\u7684\u9700\u6c42\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u751f\u6210\u52a8\u6001\u4e8c\u7ef4\u7801\uff1f<\/strong><br \/>\u4f7f\u7528Python\u751f\u6210\u52a8\u6001\u4e8c\u7ef4\u7801\u901a\u5e38\u6d89\u53ca\u5230\u4f7f\u7528\u4e00\u4e9b\u5e93\uff0c\u5982<code>qrcode<\/code>\u548c<code>Pillow<\/code>\u3002\u60a8\u53ef\u4ee5\u521b\u5efa\u4e8c\u7ef4\u7801\u5e76\u8bbe\u7f6e\u5176\u5185\u5bb9\u4e3a\u53ef\u66f4\u65b0\u7684\u94fe\u63a5\u6216\u4fe1\u606f\u3002\u901a\u8fc7\u6539\u53d8\u94fe\u63a5\u7684\u5185\u5bb9\uff0c\u60a8\u53ef\u4ee5\u5b9e\u73b0\u52a8\u6001\u6548\u679c\u3002<\/p>\n<p><strong>\u52a8\u6001\u4e8c\u7ef4\u7801\u4e0e\u9759\u6001\u4e8c\u7ef4\u7801\u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/strong><br \/>\u52a8\u6001\u4e8c\u7ef4\u7801\u662f\u53ef\u4ee5\u968f\u65f6\u66f4\u65b0\u5185\u5bb9\u7684\u4e8c\u7ef4\u7801\uff0c\u901a\u5e38\u6307\u5411\u4e00\u4e2a\u53ef\u4ee5\u4fee\u6539\u7684URL\uff0c\u800c\u9759\u6001\u4e8c\u7ef4\u7801\u5219\u5305\u542b\u56fa\u5b9a\u7684\u4fe1\u606f\uff0c\u4e00\u65e6\u751f\u6210\u5c31\u65e0\u6cd5\u66f4\u6539\u3002\u52a8\u6001\u4e8c\u7ef4\u7801\u7684\u7075\u6d3b\u6027\u4f7f\u5176\u5728\u8425\u9500\u548c\u4fe1\u606f\u5171\u4eab\u4e2d\u66f4\u52a0\u5b9e\u7528\u3002<\/p>\n<p><strong>\u6709\u54ea\u4e9bPython\u5e93\u53ef\u4ee5\u5e2e\u52a9\u6211\u5236\u4f5c\u52a8\u6001\u4e8c\u7ef4\u7801\uff1f<\/strong><br \/>\u9664\u4e86<code>qrcode<\/code>\u5e93\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528<code>PyQRCode<\/code>\u548c<code>Segno<\/code>\u7b49\u5e93\u6765\u751f\u6210\u4e8c\u7ef4\u7801\u3002\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u4e0d\u540c\u7684\u529f\u80fd\u548c\u7075\u6d3b\u6027\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728\u751f\u6210\u4e8c\u7ef4\u7801\u65f6\u6dfb\u52a0\u56fe\u50cf\u6216\u6807\u5fd7\uff1f<\/strong><br \/>\u5728\u751f\u6210\u4e8c\u7ef4\u7801\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>Pillow<\/code>\u5e93\u6765\u5904\u7406\u56fe\u50cf\u3002\u60a8\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u4e8c\u7ef4\u7801\u56fe\u50cf\u540e\uff0c\u5229\u7528<code>Pillow<\/code>\u7684\u529f\u80fd\u5c06\u60a8\u7684\u6807\u5fd7\u6216\u5176\u4ed6\u56fe\u50cf\u53e0\u52a0\u5230\u4e8c\u7ef4\u7801\u4e0a\uff0c\u589e\u5f3a\u54c1\u724c\u8bc6\u522b\u5ea6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5982\u4f55\u81ea\u5236\u52a8\u6001\u4e8c\u7ef4\u7801 \u4f7f\u7528Python\u81ea\u5236\u52a8\u6001\u4e8c\u7ef4\u7801\u9700\u8981\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a\u751f\u6210\u9759\u6001\u4e8c\u7ef4\u7801\u3001\u5c06\u591a\u4e2a\u4e8c\u7ef4\u7801\u6574 [&hellip;]","protected":false},"author":3,"featured_media":1134582,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1134575"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1134575"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1134575\/revisions"}],"predecessor-version":[{"id":1134584,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1134575\/revisions\/1134584"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1134582"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1134575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1134575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1134575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}