{"id":1103167,"date":"2025-01-08T16:07:36","date_gmt":"2025-01-08T08:07:36","guid":{"rendered":""},"modified":"2025-01-08T16:07:40","modified_gmt":"2025-01-08T08:07:40","slug":"%e6%a0%91%e8%8e%93%e6%b4%be4b%e5%a6%82%e4%bd%95%e5%8d%87%e7%ba%a7python%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1103167.html","title":{"rendered":"\u6811\u8393\u6d3e4b\u5982\u4f55\u5347\u7ea7python\u7248\u672c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25065124\/e885530f-85a7-4a5d-9b53-128ac9dfe462.webp\" alt=\"\u6811\u8393\u6d3e4b\u5982\u4f55\u5347\u7ea7python\u7248\u672c\" \/><\/p>\n<p><p> <strong>\u6811\u8393\u6d3e4b\u5982\u4f55\u5347\u7ea7Python\u7248\u672c<\/strong>\uff1a\u53ef\u4ee5\u901a\u8fc7APT\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5347\u7ea7\u3001\u4f7f\u7528pyenv\u8fdb\u884c\u591a\u7248\u672c\u7ba1\u7406\u3001\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5\u3002<strong>\u4f7f\u7528APT\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u5347\u7ea7\u8f83\u4e3a\u7b80\u5355\uff0c\u4f46\u53ef\u80fd\u65e0\u6cd5\u83b7\u5f97\u6700\u65b0\u7248\u672c<\/strong>\u3002\u4e0b\u9762\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u901a\u8fc7APT\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5347\u7ea7\u3002<\/p>\n<\/p>\n<p><p><strong>APT\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u5347\u7ea7<\/strong>\uff1a\u9996\u5148\uff0c\u66f4\u65b0\u5305\u5217\u8868\u5e76\u5347\u7ea7\u5df2\u5b89\u88c5\u7684\u5305\uff0c\u786e\u4fdd\u7cfb\u7edf\u662f\u6700\u65b0\u7684\u3002\u7136\u540e\uff0c\u4f7f\u7528APT\u5b89\u88c5\u6700\u65b0\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001\u66f4\u65b0\u7cfb\u7edf\u5305<\/h3>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u5347\u7ea7Python\u4e4b\u524d\uff0c\u786e\u4fdd\u4f60\u7684\u6811\u8393\u6d3e\u7cfb\u7edf\u662f\u6700\u65b0\u7684\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0\u5305\u5217\u8868\u5e76\u5347\u7ea7\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">sudo apt update<\/p>\n<p>sudo apt upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u786e\u4fdd\u4f60\u62e5\u6709\u6700\u65b0\u7684\u5305\u5217\u8868\uff0c\u5e76\u4e14\u6240\u6709\u7684\u7cfb\u7edf\u5305\u90fd\u662f\u6700\u65b0\u7684\u3002\u66f4\u65b0\u53ef\u80fd\u4f1a\u82b1\u8d39\u4e00\u4e9b\u65f6\u95f4\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u4f60\u5f53\u524d\u7cfb\u7edf\u7684\u72b6\u6001\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u5b89\u88c5\u4f9d\u8d56\u5305<\/h3>\n<\/p>\n<p><p>\u5728\u8fdb\u884cPython\u5347\u7ea7\u4e4b\u524d\uff0c\u5efa\u8bae\u5148\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u4f9d\u8d56\u5305\uff0c\u8fd9\u4e9b\u5305\u5728\u7f16\u8bd1\u548c\u5b89\u88c5Python\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u4f1a\u7528\u5230\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">sudo apt install -y build-essential libssl-dev libffi-dev python-dev<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e9b\u4f9d\u8d56\u5305\u5305\u62ec\u7f16\u8bd1\u5de5\u5177\u3001SSL\u5e93\u3001FFI\u5e93\u7b49\uff0c\u8fd9\u4e9b\u90fd\u662fPython\u8fd0\u884c\u65f6\u6240\u9700\u7684\u57fa\u672c\u7ec4\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528APT\u5b89\u88c5Python<\/h3>\n<\/p>\n<p><p>\u5728\u6811\u8393\u6d3e\u4e0a\uff0cAPT\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u662f\u7ba1\u7406\u548c\u5b89\u88c5\u8f6f\u4ef6\u5305\u7684\u4e3b\u8981\u5de5\u5177\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u641c\u7d22Python\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">apt-cache search python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684Python3\u7248\u672c\u3002\u627e\u5230\u4f60\u9700\u8981\u7684\u7248\u672c\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">sudo apt install python3.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c06<code>3.x<\/code>\u66ff\u6362\u4e3a\u4f60\u60f3\u8981\u5b89\u88c5\u7684Python\u7248\u672c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u60f3\u5b89\u88c5Python 3.9\uff0c\u53ef\u4ee5\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">sudo apt install python3.9<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python3.9 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u663e\u793a\u7684\u7248\u672c\u4fe1\u606f\u6b63\u786e\uff0c\u5219\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u8bbe\u7f6e\u9ed8\u8ba4Python\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u4e86\u65b0\u7684Python\u7248\u672c\u540e\uff0c\u53ef\u80fd\u9700\u8981\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4Python\u7248\u672c\u3002\u53ef\u4ee5\u4f7f\u7528<code>update-alternatives<\/code>\u547d\u4ee4\u6765\u7ba1\u7406\u4e0d\u540c\u7248\u672c\u7684Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">sudo update-alternatives --install \/usr\/bin\/python3 python3 \/usr\/bin\/python3.9 1<\/p>\n<p>sudo update-alternatives --config python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd0\u884c\u7b2c\u4e8c\u4e2a\u547d\u4ee4\u540e\uff0c\u4f60\u5c06\u770b\u5230\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u83dc\u5355\uff0c\u5141\u8bb8\u4f60\u9009\u62e9\u9ed8\u8ba4\u7684Python\u7248\u672c\u3002\u9009\u62e9\u4f60\u521a\u5b89\u88c5\u7684\u7248\u672c\u5373\u53ef\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u5b89\u88c5pip\u548c\u5176\u4ed6\u5de5\u5177<\/h3>\n<\/p>\n<p><p>\u5728\u5347\u7ea7Python\u7248\u672c\u540e\uff0c\u53ef\u80fd\u8fd8\u9700\u8981\u91cd\u65b0\u5b89\u88c5<code>pip<\/code>\u548c\u5176\u4ed6Python\u5de5\u5177\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5pip\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">sudo apt install python3-pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u9a8c\u8bc1<code>pip<\/code>\u5b89\u88c5\u662f\u5426\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u5b89\u88c5\u5176\u4ed6\u7684Python\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u5982<code>virtualenv<\/code>\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip3 install virtualenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u4f7f\u7528pyenv\u8fdb\u884c\u591a\u7248\u672c\u7ba1\u7406<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u9700\u8981\u5728\u7cfb\u7edf\u4e2d\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\uff0c<code>pyenv<\/code>\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u5de5\u5177\u3002\u9996\u5148\uff0c\u5b89\u88c5<code>pyenv<\/code>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">curl https:\/\/pyenv.run | bash<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u51e0\u884c\u5230\u4f60\u7684<code>.bashrc<\/code>\u6216<code>.bash_profile<\/code>\u6587\u4ef6\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">export PATH=&quot;$HOME\/.pyenv\/bin:$PATH&quot;<\/p>\n<p>eval &quot;$(pyenv init --path)&quot;<\/p>\n<p>eval &quot;$(pyenv init -)&quot;<\/p>\n<p>eval &quot;$(pyenv virtualenv-init -)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">source ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u4f60\u9700\u8981\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pyenv install 3.x.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c06\u5176\u8bbe\u7f6e\u4e3a\u5168\u5c40\u9ed8\u8ba4\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pyenv global 3.x.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0c\u4f60\u53ef\u4ee5\u65b9\u4fbf\u5730\u5728\u4e0d\u540c\u7684Python\u7248\u672c\u4e4b\u95f4\u5207\u6362\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u9700\u8981\u6700\u65b0\u7684Python\u7248\u672c\uff0c\u53ef\u4ee5\u9009\u62e9\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5\u3002\u9996\u5148\uff0c\u4e0b\u8f7dPython\u6e90\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">cd \/usr\/src<\/p>\n<p>sudo wget https:\/\/www.python.org\/ftp\/python\/3.x.x\/Python-3.x.x.tgz<\/p>\n<p>sudo tar xzf Python-3.x.x.tgz<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fdb\u5165\u89e3\u538b\u540e\u7684\u76ee\u5f55\uff0c\u5e76\u7f16\u8bd1\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">cd Python-3.x.x<\/p>\n<p>sudo .\/configure --enable-optimizations<\/p>\n<p>sudo make altinstall<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7f16\u8bd1\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u4e00\u6bb5\u65f6\u95f4\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u4f60\u7684\u7cfb\u7edf\u6027\u80fd\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python3.x --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516b\u3001\u9a8c\u8bc1\u5347\u7ea7\u7ed3\u679c<\/h3>\n<\/p>\n<p><p>\u5728\u5b8c\u6210Python\u5347\u7ea7\u540e\uff0c\u5efa\u8bae\u9a8c\u8bc1\u4e00\u4e9b\u5e38\u7528\u7684\u529f\u80fd\uff0c\u786e\u4fdd\u65b0\u7248\u672c\u5de5\u4f5c\u6b63\u5e38\u3002\u53ef\u4ee5\u7f16\u5199\u5e76\u8fd0\u884c\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, Python 3.x.x!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u4e3a<code>test.py<\/code>\uff0c\u5e76\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python3.x test.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u8f93\u51fa\u6b63\u786e\uff0c\u5219\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h3>\u4e5d\u3001\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u529e\u6cd5<\/h3>\n<\/p>\n<p><p><strong>\u95ee\u98981\uff1a\u65e0\u6cd5\u627e\u5230\u7279\u5b9a\u7248\u672c\u7684Python<\/strong><\/p>\n<\/p>\n<p><p>\u6709\u65f6APT\u6e90\u4e2d\u53ef\u80fd\u6ca1\u6709\u4f60\u9700\u8981\u7684Python\u7248\u672c\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528<code>pyenv<\/code>\u6216\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><p><strong>\u95ee\u98982\uff1a\u4f9d\u8d56\u5305\u5b89\u88c5\u5931\u8d25<\/strong><\/p>\n<\/p>\n<p><p>\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u5305\u662f\u6700\u65b0\u7684\uff0c\u5e76\u4e14\u7f51\u7edc\u8fde\u63a5\u6b63\u5e38\u3002\u53ef\u4ee5\u5c1d\u8bd5\u66f4\u6362APT\u6e90\uff0c\u4f7f\u7528\u66f4\u7a33\u5b9a\u7684\u955c\u50cf\u3002<\/p>\n<\/p>\n<p><p><strong>\u95ee\u98983\uff1a\u5b89\u88c5\u540e\u65e0\u6cd5\u5207\u6362\u7248\u672c<\/strong><\/p>\n<\/p>\n<p><p>\u786e\u4fdd\u4f60\u6b63\u786e\u8bbe\u7f6e\u4e86<code>update-alternatives<\/code>\uff0c\u5e76\u4e14\u5728\u4f60\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u6dfb\u52a0\u4e86\u65b0Python\u7248\u672c\u7684\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><p><strong>\u95ee\u98984\uff1apip\u5b89\u88c5\u5931\u8d25<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u5c1d\u8bd5\u901a\u8fc7<code>get-pip.py<\/code>\u811a\u672c\u91cd\u65b0\u5b89\u88c5pip\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">curl https:\/\/bootstrap.pypa.io\/get-pip.py -o get-pip.py<\/p>\n<p>python3.x get-pip.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5341\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5347\u7ea7Python\u7248\u672c\u662f\u4e00\u4e2a\u76f8\u5bf9\u7b80\u5355\u7684\u8fc7\u7a0b\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u4e00\u4e9b\u7ec6\u8282\u3002\u901a\u8fc7APT\u3001pyenv\u6216\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u8981\u9009\u62e9\u6700\u9002\u5408\u81ea\u5df1\u7684\u65b9\u6cd5\u3002\u786e\u4fdd\u5728\u5347\u7ea7\u8fc7\u7a0b\u4e2d\u5907\u4efd\u91cd\u8981\u6570\u636e\uff0c\u5e76\u5728\u5347\u7ea7\u5b8c\u6210\u540e\u8fdb\u884c\u529f\u80fd\u9a8c\u8bc1\uff0c\u4ee5\u786e\u4fdd\u65b0\u7248\u672c\u8fd0\u884c\u6b63\u5e38\u3002\u65e0\u8bba\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\uff0c\u4e86\u89e3\u6bcf\u79cd\u65b9\u6cd5\u7684\u4f18\u7f3a\u70b9\uff0c\u5e76\u6839\u636e\u5177\u4f53\u9700\u6c42\u8fdb\u884c\u9009\u62e9\uff0c\u5c06\u5e2e\u52a9\u4f60\u66f4\u987a\u5229\u5730\u5b8c\u6210Python\u7248\u672c\u7684\u5347\u7ea7\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5\u5f53\u524d\u6811\u8393\u6d3e4B\u4e0a\u5b89\u88c5\u7684Python\u7248\u672c\uff1f<\/strong><br \/>\u5728\u6811\u8393\u6d3e4B\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00\u7ec8\u7aef\u5e76\u8f93\u5165\u547d\u4ee4 <code>python --version<\/code> \u6216 <code>python3 --version<\/code> \u6765\u68c0\u67e5\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u3002\u8fd9\u5c06\u663e\u793a\u4f60\u5f53\u524d\u4f7f\u7528\u7684Python\u7248\u672c\u4fe1\u606f\uff0c\u5e2e\u52a9\u4f60\u786e\u8ba4\u662f\u5426\u9700\u8981\u8fdb\u884c\u5347\u7ea7\u3002<\/p>\n<p><strong>\u5347\u7ea7Python\u7248\u672c\u9700\u8981\u5907\u4efd\u73b0\u6709\u73af\u5883\u5417\uff1f<\/strong><br \/>\u5728\u5347\u7ea7Python\u7248\u672c\u4e4b\u524d\uff0c\u5efa\u8bae\u5907\u4efd\u73b0\u6709\u7684Python\u73af\u5883\u548c\u9879\u76ee\u3002\u901a\u8fc7\u4f7f\u7528\u865a\u62df\u73af\u5883\uff08\u5982venv\u6216virtualenv\uff09\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u72ec\u7acb\u7684\u73af\u5883\uff0c\u4ee5\u907f\u514d\u4e0e\u7cfb\u7edf\u5176\u4ed6\u7a0b\u5e8f\u7684\u51b2\u7a81\u3002\u5907\u4efd\u73b0\u6709\u7684\u9879\u76ee\u6587\u4ef6\u548c\u4f9d\u8d56\u9879\uff0c\u53ef\u4ee5\u786e\u4fdd\u5728\u5347\u7ea7\u8fc7\u7a0b\u4e2d\u6570\u636e\u4e0d\u4f1a\u4e22\u5931\u3002<\/p>\n<p><strong>\u6811\u8393\u6d3e4B\u4e0a\u5347\u7ea7Python\u7248\u672c\u7684\u6b65\u9aa4\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u5347\u7ea7Python\u7248\u672c\u7684\u6b65\u9aa4\u901a\u5e38\u5305\u62ec\u66f4\u65b0\u7cfb\u7edf\u5305\u7ba1\u7406\u5668\uff0c\u5b89\u88c5\u6240\u9700\u7684\u4f9d\u8d56\u5e93\uff0c\u7136\u540e\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Python\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a  <\/p>\n<ol>\n<li>\u66f4\u65b0\u7cfb\u7edf\uff1a<code>sudo apt update &amp;&amp; sudo apt upgrade<\/code>  <\/li>\n<li>\u5b89\u88c5\u6784\u5efa\u4f9d\u8d56\uff1a<code>sudo apt install -y build-essential libssl-dev libffi-dev python3-dev<\/code>  <\/li>\n<li>\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Python\u6e90\u4ee3\u7801\uff1a<code>wget https:\/\/www.python.org\/ftp\/python\/X.X.X\/Python-X.X.X.tgz<\/code>\uff08\u66ff\u6362\u4e3a\u6240\u9700\u7248\u672c\uff09  <\/li>\n<li>\u89e3\u538b\u5e76\u5b89\u88c5\uff1a\n<pre><code class=\"language-bash\">tar -xvf Python-X.X.X.tgz  \ncd Python-X.X.X  \n.\/configure  \nmake  \nsudo make altinstall  \n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u8fd9\u6837\u53ef\u4ee5\u5728\u4e0d\u5e72\u6270\u7cfb\u7edfPython\u7684\u60c5\u51b5\u4e0b\u5b89\u88c5\u65b0\u7248\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u6811\u8393\u6d3e4b\u5982\u4f55\u5347\u7ea7Python\u7248\u672c\uff1a\u53ef\u4ee5\u901a\u8fc7APT\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5347\u7ea7\u3001\u4f7f\u7528pyenv\u8fdb\u884c\u591a\u7248\u672c\u7ba1\u7406\u3001\u4ece\u6e90\u4ee3\u7801 [&hellip;]","protected":false},"author":3,"featured_media":1103182,"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\/1103167"}],"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=1103167"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1103167\/revisions"}],"predecessor-version":[{"id":1103184,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1103167\/revisions\/1103184"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1103182"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1103167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1103167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1103167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}