{"id":1784,"date":"2021-10-02T14:08:57","date_gmt":"2021-10-02T06:08:57","guid":{"rendered":"https:\/\/blog.iyatt.com\/?p=1784"},"modified":"2024-05-05T14:20:55","modified_gmt":"2024-05-05T06:20:55","slug":"python-%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/blog.iyatt.com\/?p=1784","title":{"rendered":"Python \u7f16\u8bd1\u5b89\u88c5"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title ez-toc-toggle\" style=\"cursor:pointer\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.iyatt.com\/?p=1784\/#%E7%8E%AF%E5%A2%83\" >\u73af\u5883<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.iyatt.com\/?p=1784\/#%E6%93%8D%E4%BD%9C\" >\u64cd\u4f5c<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E7%8E%AF%E5%A2%83\"><\/span>\u73af\u5883<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Ubuntu 22.04\uff08Windows 11 22H2 \u4e13\u4e1a\u5de5\u4f5c\u7ad9\u7248 WSL2\uff09<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E6%93%8D%E4%BD%9C\"><\/span>\u64cd\u4f5c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5b89\u88c5\u4f9d\u8d56<\/p>\n<pre><code class=\"language-bash\">sudo apt update\nsudo apt install -y libssl-dev libffi-dev libbz2-dev git build-essential libx11-dev sqlite3 libsqlite3-dev zlib1g-dev libtommath-dev pkg-config<\/code><\/pre>\n<p>\u7f16\u8bd1\u5b89\u88c5 tcl\/tk\uff08Tkinter \u7684\u4f9d\u8d56\uff09<\/p>\n<pre><code class=\"language-bash\">cd \/tmp\ngit clone https:\/\/github.com\/tcltk\/tcl.git --depth=1 --branch=core-8-6-13\ncd tcl\/unix\n.\/configure\nsudo make install -j$(nproc)\n\ncd \/tmp\ngit clone https:\/\/github.com\/tcltk\/tk.git --depth=1 --branch=core-8-6-13\ncd tk\/unix\n.\/configure\nsudo make install -j$(nproc)<\/code><\/pre>\n<p>\u7f16\u8bd1\u5b89\u88c5 Python 3.11.3<\/p>\n<pre><code class=\"language-bash\">cd \/tmp\ngit clone https:\/\/github.com\/python\/cpython.git --depth=1 --branch=v3.11.3\ncd cpython\n.\/configure --enable-optimizations --enable-loadable-sqlite-extensions --with-tcltk-includes=&#039;-I\/usr\/local\/include\/&#039; --with-tcltk-libs=&#039;\/usr\/local\/lib\/libtcl8.6.so \/usr\/local\/lib\/libtk8.6.so&#039;\nsudo make install -j$(nproc)<\/code><\/pre>\n<p>\u7f16\u8bd1\u5b89\u88c5\u7684 Python \u53ef\u6267\u884c\u6587\u4ef6\u9ed8\u8ba4\u662f\u5728 \/usr\/local\/bin \u4e0b<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2021\/10\/image-1685878203697.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 630px; --smush-placeholder-aspect-ratio: 630\/83;\" \/><\/p>\n<p>\u56e0\u4e3a\u7cfb\u7edf\u9884\u88c5\u4e86 Python3.10.6\uff0c\u76ee\u524d python3 \u8f6f\u94fe\u63a5\u7684\u5c31\u662f\u5b83<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2021\/10\/image-1685878379389.png\" alt=\"\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 555px; --smush-placeholder-aspect-ratio: 555\/142;\" \/><\/p>\n<p>\u8003\u8651\u5230\u7cfb\u7edf\u53ef\u80fd\u5b58\u5728\u4f9d\u8d56\u5173\u7cfb\uff0c\u8fd9\u4e2a python3 \u7684\u8f6f\u94fe\u63a5\u8fd8\u662f\u4fdd\u7559\uff0c\u7ed9\u65b0\u5b89\u88c5\u7684 Python3.11.3 \u521b\u5efa\u8f6f\u94fe\u63a5\u4e3a python\uff0c\u7b80\u5316\u4f7f\u7528<\/p>\n<pre><code class=\"language-bash\">sudo ln -s \/usr\/local\/bin\/python3.11 \/usr\/bin\/python<\/code><\/pre>\n<p>\u7136\u540e\u6d4b\u8bd5\u4e00\u4e0b Tkinter<\/p>\n<pre><code class=\"language-bash\">python -m tkinter<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2021\/10\/image-1685878884848.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 336px; --smush-placeholder-aspect-ratio: 336\/164;\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883 Ubuntu 22.04\uff08Windows 11 22H2 \u4e13\u4e1a\u5de5\u4f5c\u7ad9\u7248 WSL2\uff09 \u64cd\u4f5c \u5b89\u88c5\u4f9d\u8d56 su [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"_lmt_disableupdate":"no","_lmt_disable":"no","footnotes":""},"categories":[1,592],"tags":[],"class_list":["post-1784","post","type-post","status-publish","format-standard","hentry","category-all","category-python"],"modified_by":"IYATT-yx","_links":{"self":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/1784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1784"}],"version-history":[{"count":0,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/1784\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}