{"id":921748,"date":"2024-12-26T14:18:46","date_gmt":"2024-12-26T06:18:46","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/921748.html"},"modified":"2024-12-26T14:18:47","modified_gmt":"2024-12-26T06:18:47","slug":"linux%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85python3","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/921748.html","title":{"rendered":"linux\u5982\u4f55\u5b89\u88c5python3"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24210558\/464f31b6-dc63-4bcb-a385-3a7b89d63ce7.webp\" alt=\"linux\u5982\u4f55\u5b89\u88c5python3\" \/><\/p>\n<p><p> <strong>\u5728Linux\u4e0a\u5b89\u88c5Python3\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5305\u62ec\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u3001\u7f16\u8bd1\u6e90\u4ee3\u7801\u3001\u4f7f\u7528Python\u73af\u5883\u7ba1\u7406\u5de5\u5177\u7b49<\/strong>\u3002\u5176\u4e2d\uff0c\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u901a\u8fc7\u7cfb\u7edf\u7684\u5305\u7ba1\u7406\u5668\uff0c\u5982APT\u3001YUM\u7b49\u8fdb\u884c\u5b89\u88c5\uff0c\u5177\u4f53\u6b65\u9aa4\u56e0Linux\u53d1\u884c\u7248\u800c\u5f02\u3002\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5\uff0c\u8fd9\u79cd\u65b9\u5f0f\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u7075\u6d3b\u6027\uff0c\u9002\u5408\u9700\u8981\u7279\u5b9a\u7248\u672c\u6216\u81ea\u5b9a\u4e49\u7f16\u8bd1\u9009\u9879\u7684\u7528\u6237\u3002\u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u5982pyenv\u7b49\u5de5\u5177\u6765\u7ba1\u7406Python\u7248\u672c\uff0c\u5b9e\u73b0\u591a\u4e2a\u7248\u672c\u7684\u5e76\u5b58\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\u7684\u4e00\u79cd\uff1a\u901a\u8fc7\u5305\u7ba1\u7406\u5668APT\u5b89\u88c5Python3\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u5305\u7ba1\u7406\u5668APT\u5b89\u88c5Python3\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u5305\u7ba1\u7406\u5668\u548c\u8f6f\u4ef6\u5305\u5217\u8868\u662f\u6700\u65b0\u7684\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt update<\/p>\n<p>sudo apt upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Python3\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3<\/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\u8bc1Python3\u662f\u5426\u5df2\u6210\u529f\u5b89\u88c5\uff0c\u5e76\u67e5\u770b\u5176\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u9700\u8981pip3\uff08Python3\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3-pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u5173\u4e8e\u5728Linux\u4e0a\u5b89\u88c5Python3\u7684\u8be6\u7ec6\u6307\u5357\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u901a\u8fc7APT\u5305\u7ba1\u7406\u5668\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>APT\u662fDebian\u53ca\u5176\u884d\u751f\u53d1\u884c\u7248\uff08\u5982Ubuntu\u3001Linux Mint\u7b49\uff09\u4f7f\u7528\u7684\u5305\u7ba1\u7406\u7cfb\u7edf\u3002\u4f7f\u7528APT\u6765\u5b89\u88c5Python3\u662f\u6700\u7b80\u4fbf\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002<\/p>\n<\/p>\n<p><h4>1. \u66f4\u65b0\u7cfb\u7edf\u5305\u7ba1\u7406\u5668<\/h4>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u4efb\u4f55\u8f6f\u4ef6\u4e4b\u524d\uff0c\u6700\u597d\u66f4\u65b0\u7cfb\u7edf\u7684\u5305\u7ba1\u7406\u5668\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u8f6f\u4ef6\u5305\u90fd\u662f\u6700\u65b0\u7684\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt update<\/p>\n<p>sudo apt upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e24\u4e2a\u547d\u4ee4\u5206\u522b\u7528\u4e8e\u66f4\u65b0\u8f6f\u4ef6\u5305\u5217\u8868\u548c\u5347\u7ea7\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\n<\/p>\n<p><h4>2. \u5b89\u88c5Python3<\/h4>\n<\/p>\n<p><p>\u66f4\u65b0\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Python3\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u547d\u4ee4\u5c06\u4f1a\u4ece\u8f6f\u4ef6\u6e90\u4e2d\u4e0b\u8f7d\u5e76\u5b89\u88c5Python3\u3002<\/p>\n<\/p>\n<p><h4>3. \u9a8c\u8bc1\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1Python3\u662f\u5426\u5df2\u6210\u529f\u5b89\u88c5\uff0c\u5e76\u67e5\u770b\u5176\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u663e\u793a\u51fa\u7248\u672c\u53f7\uff0c\u8bf4\u660ePython3\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h4>4. \u5b89\u88c5pip3<\/h4>\n<\/p>\n<p><p>pip\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u7528\u4e8e\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\u3002\u8981\u5b89\u88c5pip3\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3-pip<\/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\u8bc1pip3\u662f\u5426\u5df2\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u901a\u8fc7YUM\u5305\u7ba1\u7406\u5668\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>YUM\u662f\u7528\u4e8eRed Hat\u53ca\u5176\u884d\u751f\u53d1\u884c\u7248\uff08\u5982CentOS\u3001Fedora\u7b49\uff09\u7684\u4e00\u79cd\u5305\u7ba1\u7406\u5668\u3002\u4e0eAPT\u7c7b\u4f3c\uff0cYUM\u4e5f\u53ef\u4ee5\u8f7b\u677e\u5730\u5b89\u88c5Python3\u3002<\/p>\n<\/p>\n<p><h4>1. \u66f4\u65b0\u7cfb\u7edf\u5305\u7ba1\u7406\u5668<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u662f\u6700\u65b0\u7684\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo yum update<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u5b89\u88c5Python3<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528YUM\u5b89\u88c5Python3\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo yum install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u9a8c\u8bc1\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bPython3\u7684\u7248\u672c\uff0c\u786e\u4fdd\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u5b89\u88c5pip3<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981pip3\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo yum install python3-pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5Python3\u53ef\u4ee5\u83b7\u5f97\u66f4\u591a\u7684\u7075\u6d3b\u6027\u548c\u4f18\u5316\u9009\u9879\uff0c\u9002\u5408\u9700\u8981\u7279\u5b9a\u914d\u7f6e\u7684\u9ad8\u7ea7\u7528\u6237\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u4f9d\u8d56\u5305<\/h4>\n<\/p>\n<p><p>\u5728\u7f16\u8bd1Python3\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u4f9d\u8d56\u5305\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install build-essential libssl-dev libffi-dev zlib1g-dev<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4e0b\u8f7dPython\u6e90\u7801<\/h4>\n<\/p>\n<p><p>\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff0c\u4e0b\u8f7d\u4f60\u9700\u8981\u7684Python\u7248\u672c\u7684\u6e90\u7801\u3002\u6216\u8005\u4f7f\u7528wget\u547d\u4ee4\u4e0b\u8f7d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">wget https:\/\/www.python.org\/ftp\/python\/3.x.x\/Python-3.x.x.tgz<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c063.x.x\u66ff\u6362\u4e3a\u4f60\u9700\u8981\u7684\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h4>3. \u89e3\u538b\u6e90\u7801\u5305<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528tar\u547d\u4ee4\u89e3\u538b\u4e0b\u8f7d\u7684\u6e90\u7801\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">tar xvf Python-3.x.x.tgz<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u7f16\u8bd1\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u8fdb\u5165\u89e3\u538b\u540e\u7684\u76ee\u5f55\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">cd Python-3.x.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u914d\u7f6e\u7f16\u8bd1\u9009\u9879\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">.\/configure --enable-optimizations<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7f16\u8bd1\u5e76\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">make<\/p>\n<p>sudo make install<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>5. \u9a8c\u8bc1\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u7f16\u8bd1\u5b8c\u6210\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528pyenv\u7ba1\u7406Python\u7248\u672c<\/h3>\n<\/p>\n<p><p>pyenv\u662f\u4e00\u79cdPython\u7248\u672c\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u5141\u8bb8\u4f60\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5\u548c\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\uff0c\u975e\u5e38\u9002\u5408\u9700\u8981\u5728\u4e0d\u540c\u9879\u76ee\u4e2d\u4f7f\u7528\u4e0d\u540cPython\u7248\u672c\u7684\u5f00\u53d1\u8005\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5pyenv<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u7cfb\u7edf\u5b89\u88c5\u4e86\u5fc5\u8981\u7684\u4f9d\u8d56\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install curl git<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u4f7f\u7528curl\u547d\u4ee4\u5b89\u88c5pyenv\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">curl https:\/\/pyenv.run | bash<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6309\u7167\u5b89\u88c5\u63d0\u793a\uff0c\u5c06\u4ee5\u4e0b\u884c\u6dfb\u52a0\u5230\u4f60\u7684shell\u914d\u7f6e\u6587\u4ef6\uff08\u5982~\/.bashrc\uff09\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">export PATH=&quot;$HOME\/.pyenv\/bin:$PATH&quot;<\/p>\n<p>eval &quot;$(pyenv init --path)&quot;<\/p>\n<p>eval &quot;$(pyenv virtualenv-init -)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u91cd\u65b0\u52a0\u8f7dshell\u914d\u7f6e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u5b89\u88c5Python\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528pyenv\u5b89\u88c5Python3.8.10\uff08\u6216\u5176\u4ed6\u7248\u672c\uff09\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv install 3.8.10<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u8bbe\u7f6e\u5168\u5c40Python\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u9ed8\u8ba4\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv global 3.8.10<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u9a8c\u8bc1\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528pyenv\u7684\u4f18\u52bf\u5728\u4e8e\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u8981\u968f\u65f6\u5207\u6362Python\u7248\u672c\uff0c\u975e\u5e38\u7075\u6d3b\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5728Linux\u4e0a\u5b89\u88c5Python3\u6709\u591a\u79cd\u65b9\u6cd5\uff0c\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u4f18\u7f3a\u70b9\u3002\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u662f\u6700\u7b80\u5355\u7684\u65b9\u5f0f\uff0c\u9002\u5408\u5927\u591a\u6570\u7528\u6237\uff1b\u4ece\u6e90\u7801\u7f16\u8bd1\u5b89\u88c5\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u5b9a\u5236\u9009\u9879\uff0c\u9002\u5408\u9ad8\u7ea7\u7528\u6237\uff1b\u800c\u4f7f\u7528pyenv\u5219\u63d0\u4f9b\u4e86\u7075\u6d3b\u7684\u7248\u672c\u7ba1\u7406\u529f\u80fd\u3002\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u548c\u4f7f\u7528\u73af\u5883\uff0c\u9009\u62e9\u6700\u5408\u9002\u7684\u65b9\u6cd5\u6765\u5b89\u88c5Python3\u3002\u901a\u8fc7\u8fd9\u4e9b\u8be6\u7ec6\u7684\u6b65\u9aa4\u6307\u5bfc\uff0c\u5e0c\u671b\u4f60\u80fd\u591f\u987a\u5229\u5728Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5\u5e76\u4f7f\u7528Python3\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Linux\u4e0a\u5b89\u88c5Python 3\uff1f<\/strong><br \/>\u5728Linux\u4e0a\u5b89\u88c5Python 3\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u8fdb\u884c\u3002\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528\u7cfb\u7edf\u7684\u5305\u7ba1\u7406\u5668\uff0c\u5982apt\uff08\u5728Debian\u6216Ubuntu\u7cfb\u7edf\u4e0a\uff09\u6216yum\uff08\u5728CentOS\u6216Fedora\u7cfb\u7edf\u4e0a\uff09\u3002\u4f60\u4e5f\u53ef\u4ee5\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5\uff0c\u6216\u8005\u4f7f\u7528pyenv\u7b49\u5de5\u5177\u8fdb\u884c\u7ba1\u7406\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\n<p>\u5bf9\u4e8eDebian\u548cUbuntu\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"language-bash\">sudo apt update\nsudo apt install python3\n<\/code><\/pre>\n<\/li>\n<li>\n<p>\u5bf9\u4e8eCentOS\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a<\/p>\n<pre><code class=\"language-bash\">sudo yum install python3\n<\/code><\/pre>\n<\/li>\n<li>\n<p>\u82e5\u9009\u62e9\u7f16\u8bd1\u5b89\u88c5\uff0c\u9996\u5148\u9700\u8981\u4e0b\u8f7dPython\u6e90\u4ee3\u7801\uff0c\u7136\u540e\u89e3\u538b\u5e76\u6267\u884c\uff1a<\/p>\n<pre><code class=\"language-bash\">.\/configure\nmake\nsudo make install\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p><strong>\u5728Linux\u4e0a\u53ef\u4ee5\u4f7f\u7528\u54ea\u4e9b\u547d\u4ee4\u6765\u9a8c\u8bc1Python 3\u7684\u5b89\u88c5\uff1f<\/strong><br \/>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9a8c\u8bc1Python 3\u662f\u5426\u6b63\u786e\u5b89\u88c5\u662f\u5f88\u91cd\u8981\u7684\u3002\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u7248\u672c\uff1a<\/p>\n<pre><code class=\"language-bash\">python3 --version\n<\/code><\/pre>\n<p>\u5982\u679c\u8fd4\u56de\u7684\u662fPython 3\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Linux\u4e0a\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\uff1f<\/strong><br \/>\u4f7f\u7528pyenv\u662f\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u7684\u4e00\u79cd\u6709\u6548\u65b9\u6cd5\u3002\u5b89\u88c5pyenv\u540e\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5207\u6362\u4e0d\u540c\u7684Python\u7248\u672c\uff0c\u751a\u81f3\u4e3a\u4e0d\u540c\u7684\u9879\u76ee\u6307\u5b9a\u7279\u5b9a\u7248\u672c\u3002\u5b89\u88c5\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\n<p>\u9996\u5148\u5b89\u88c5\u4f9d\u8d56\u9879\uff1a<\/p>\n<pre><code class=\"language-bash\">sudo apt install -y build-essential libssl-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libffi-dev zlib1g-dev\n<\/code><\/pre>\n<\/li>\n<li>\n<p>\u7136\u540e\u4eceGitHub\u514b\u9686pyenv\uff1a<\/p>\n<pre><code class=\"language-bash\">curl https:\/\/pyenv.run | bash\n<\/code><\/pre>\n<\/li>\n<li>\n<p>\u6700\u540e\uff0c\u901a\u8fc7\u914d\u7f6eshell\u73af\u5883\u53d8\u91cf\u6765\u6fc0\u6d3bpyenv\u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u5728Linux\u4e0a\u65b9\u4fbf\u5730\u5b89\u88c5\u548c\u7ba1\u7406Python 3\u53ca\u5176\u591a\u4e2a\u7248\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Linux\u4e0a\u5b89\u88c5Python3\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5305\u62ec\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u3001\u7f16\u8bd1\u6e90\u4ee3\u7801\u3001\u4f7f\u7528Python\u73af\u5883\u7ba1\u7406\u5de5 [&hellip;]","protected":false},"author":3,"featured_media":921749,"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\/921748"}],"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=921748"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/921748\/revisions"}],"predecessor-version":[{"id":921750,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/921748\/revisions\/921750"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/921749"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=921748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=921748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=921748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}