{"id":945097,"date":"2024-12-26T23:20:32","date_gmt":"2024-12-26T15:20:32","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/945097.html"},"modified":"2024-12-26T23:20:34","modified_gmt":"2024-12-26T15:20:34","slug":"liunx%e5%a6%82%e4%bd%95%e5%8d%87%e7%ba%a7python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/945097.html","title":{"rendered":"liunx\u5982\u4f55\u5347\u7ea7python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25081639\/d468c3c6-dab9-4dd0-8ce7-6eefc99183ff.webp\" alt=\"liunx\u5982\u4f55\u5347\u7ea7python\" \/><\/p>\n<p><p> <strong>\u5728Linux\u4e0a\u5347\u7ea7Python\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\uff1a\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u66f4\u65b0\u3001\u624b\u52a8\u7f16\u8bd1\u5b89\u88c5\u3001\u4f7f\u7528pyenv\u7ba1\u7406\u591a\u4e2a\u7248\u672c\u3002<\/strong> \u5176\u4e2d\uff0c<strong>\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u66f4\u65b0<\/strong> \u662f\u6700\u7b80\u5355\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3a\u5b83\u80fd\u591f\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\u548c\u7248\u672c\u517c\u5bb9\u6027\u95ee\u9898\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u5e76\u63d0\u4f9b\u6b65\u9aa4\u548c\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u66f4\u65b0<\/p>\n<\/p>\n<p><p>Linux\u53d1\u884c\u7248\u901a\u5e38\u9644\u5e26\u4e00\u4e2a\u5305\u7ba1\u7406\u5668\uff0c\u5982Ubuntu\u7684APT\u3001CentOS\u7684YUM\u7b49\uff0c\u8fd9\u4e9b\u5305\u7ba1\u7406\u5668\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u8f7b\u677e\u66f4\u65b0Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h3>1. \u4f7f\u7528APT\uff08\u9002\u7528\u4e8eDebian\/Ubuntu\uff09<\/h3>\n<\/p>\n<p><p>APT\u662fDebian\u548cUbuntu\u7cfb\u7edf\u4e0a\u6700\u5e38\u7528\u7684\u5305\u7ba1\u7406\u5668\u3002\u4f7f\u7528APT\u66f4\u65b0Python\u7248\u672c\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u66f4\u65b0\u5305\u7d22\u5f15<\/strong>\uff1a\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u5305\u7ba1\u7406\u5668\u4f7f\u7528\u7684\u662f\u6700\u65b0\u7684\u8f6f\u4ef6\u5305\u4fe1\u606f\u3002\u6253\u5f00\u7ec8\u7aef\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt update<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u6700\u65b0\u7684Python\u7248\u672c<\/strong>\uff1a\u4f7f\u7528apt\u5b89\u88c5\u6216\u5347\u7ea7Python\u3002\u4e00\u822c\u6765\u8bf4\uff0cUbuntu\u4ed3\u5e93\u4e2d\u4f1a\u63d0\u4f9b\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9a8c\u8bc1Python\u7248\u672c\u4ee5\u786e\u4fdd\u66f4\u65b0\u6210\u529f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>2. \u4f7f\u7528YUM\uff08\u9002\u7528\u4e8eCentOS\/RHEL\uff09<\/h3>\n<\/p>\n<p><p>YUM\u662fCentOS\u548cRed Hat Enterprise Linux\u7cfb\u7edf\u7684\u9ed8\u8ba4\u5305\u7ba1\u7406\u5668\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528YUM\u66f4\u65b0Python\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u542f\u7528EPEL\uff08Extra Packages for Enterprise Linux\uff09<\/strong>\uff1a\u4e3a\u4e86\u83b7\u5f97\u6700\u65b0\u7248\u672c\u7684Python\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u542f\u7528EPEL\u5b58\u50a8\u5e93\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo yum install epel-release<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python<\/strong>\uff1a\u901a\u8fc7YUM\u5b89\u88c5\u6700\u65b0\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo yum install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a\u68c0\u67e5Python\u7248\u672c\u4ee5\u786e\u4fdd\u66f4\u65b0\u6210\u529f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><p><strong>\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u66f4\u65b0Python\u7248\u672c\u901a\u5e38\u662f\u6700\u7b80\u5355\u4e14\u6700\u5b89\u5168\u7684\u65b9\u6cd5<\/strong>\uff0c\u4f46\u53ef\u80fd\u4f1a\u53d7\u5230\u7cfb\u7edf\u81ea\u5e26\u7248\u672c\u7684\u9650\u5236\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u624b\u52a8\u7f16\u8bd1\u5b89\u88c5<\/p>\n<\/p>\n<p><p>\u624b\u52a8\u7f16\u8bd1\u5b89\u88c5Python\u53ef\u4ee5\u8ba9\u4f60\u83b7\u5f97\u6700\u65b0\u7684\u7248\u672c\uff0c\u751a\u81f3\u662f\u6d4b\u8bd5\u7248\uff0c\u4f46\u9700\u8981\u5904\u7406\u4f9d\u8d56\u548c\u73af\u5883\u914d\u7f6e\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>1. \u4e0b\u8f7d\u6e90\u7801<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4e0b\u8f7dPython\u7684\u6e90\u7801\u5305\u3002\u4f60\u53ef\u4ee5\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u83b7\u53d6\u6700\u65b0\u7684\u6e90\u7801\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p>\u4f7f\u7528wget\u547d\u4ee4\u4e0b\u8f7d\u6e90\u7801\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<\/li>\n<li>\n<p>\u89e3\u538b\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<\/li>\n<\/ul>\n<p><h3>2. \u7f16\u8bd1\u548c\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u7f16\u8bd1Python\u9700\u8981\u4e00\u4e9b\u5f00\u53d1\u5de5\u5177\u548c\u5e93\uff0c\u786e\u4fdd\u5b83\u4eec\u5df2\u7ecf\u5b89\u88c5\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56<\/strong>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u548c\u7f16\u8bd1\u6e90\u7801<\/strong>\uff1a<\/p>\n<p>\u8fdb\u5165\u89e3\u538b\u540e\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">cd Python-3.x.x<\/p>\n<p>.\/configure --enable-optimizations<\/p>\n<p>make -j $(nproc)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python<\/strong>\uff1a<\/p>\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u7f16\u8bd1\u540e\u7684Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo make altinstall<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a\u68c0\u67e5\u5b89\u88c5\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3.x --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u624b\u52a8\u7f16\u8bd1\u5b89\u88c5\u53ef\u4ee5\u83b7\u5f97\u6700\u65b0\u7684Python\u7248\u672c\uff0c\u4f46\u9700\u8981\u66f4\u591a\u7684\u6280\u672f\u77e5\u8bc6\u548c\u65f6\u95f4\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528pyenv\u7ba1\u7406\u591a\u4e2a\u7248\u672c<\/p>\n<\/p>\n<p><p>pyenv\u662f\u4e00\u6b3ePython\u7248\u672c\u7ba1\u7406\u5de5\u5177\uff0c\u5141\u8bb8\u7528\u6237\u5728\u540c\u4e00\u7cfb\u7edf\u4e0a\u5b89\u88c5\u591a\u4e2aPython\u7248\u672c\u5e76\u5728\u5b83\u4eec\u4e4b\u95f4\u5207\u6362\u3002<\/p>\n<\/p>\n<p><h3>1. \u5b89\u88c5pyenv<\/h3>\n<\/p>\n<p><p>\u8981\u4f7f\u7528pyenv\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5b83\u3002\u4ee5\u4e0b\u662f\u5b89\u88c5\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u5b89\u88c5\u4f9d\u8d56<\/strong>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5pyenv<\/strong>\uff1a\u53ef\u4ee5\u901a\u8fc7git\u514b\u9686pyenv\u5230\u672c\u5730\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">curl https:\/\/pyenv.run | bash<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\uff1a\u5728\u4f60\u7684shell\u914d\u7f6e\u6587\u4ef6\uff08\u5982<code>~\/.bashrc<\/code>\u6216<code>~\/.bash_profile<\/code>\uff09\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\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 init -)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u91cd\u542fshell<\/strong>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">exec $SHELL<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>2. \u4f7f\u7528pyenv\u5b89\u88c5Python<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528pyenv\u5b89\u88c5\u4e0d\u540c\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python<\/strong>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv install 3.x.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbe\u7f6e\u5168\u5c40Python\u7248\u672c<\/strong>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv global 3.x.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><p><strong>pyenv\u63d0\u4f9b\u4e86\u7075\u6d3b\u6027<\/strong>\uff0c\u5141\u8bb8\u5728\u591a\u4e2a\u9879\u76ee\u4e2d\u4f7f\u7528\u4e0d\u540c\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u6ce8\u610f\u4e8b\u9879\u548c\u6700\u4f73\u5b9e\u8df5<\/p>\n<\/p>\n<p><p>\u5728\u5347\u7ea7Python\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\u4ee5\u907f\u514d\u6f5c\u5728\u95ee\u9898\uff1a<\/p>\n<\/p>\n<p><h3>1. \u5907\u4efd\u548c\u6d4b\u8bd5<\/h3>\n<\/p>\n<p><p>\u5728\u5347\u7ea7Python\u4e4b\u524d\uff0c\u5907\u4efd\u73b0\u6709\u7684Python\u73af\u5883\u548c\u76f8\u5173\u9879\u76ee\uff0c\u786e\u4fdd\u5347\u7ea7\u540e\u53ef\u4ee5\u8fd8\u539f\u3002<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528\u865a\u62df\u73af\u5883\uff1a\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u865a\u62df\u73af\u5883\uff08\u5982venv\u6216virtualenv\uff09\u9694\u79bb\u9879\u76ee\u4f9d\u8d56\u3002<\/li>\n<li>\u6d4b\u8bd5\u517c\u5bb9\u6027\uff1a\u5728\u5347\u7ea7\u540e\uff0c\u6d4b\u8bd5\u6240\u6709\u9879\u76ee\u4ee5\u786e\u4fdd\u517c\u5bb9\u6027\u3002<\/li>\n<\/ul>\n<p><h3>2. \u5904\u7406\u4f9d\u8d56\u5173\u7cfb<\/h3>\n<\/p>\n<p><p>\u65b0\u7248\u672c\u7684Python\u53ef\u80fd\u4f1a\u5f15\u5165\u4e0d\u517c\u5bb9\u7684\u53d8\u5316\uff0c\u56e0\u6b64\u9700\u8981\u68c0\u67e5\u548c\u66f4\u65b0\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\u3002<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528<code>pip list<\/code>\u67e5\u770b\u5f53\u524d\u73af\u5883\u4e2d\u7684\u6240\u6709\u5305\uff0c\u7136\u540e\u4f7f\u7528<code>pip install --upgrade<\/code>\u66f4\u65b0\u3002<\/li>\n<li>\u67e5\u770b\u9879\u76ee\u7684<code>requirements.txt<\/code>\u6587\u4ef6\uff0c\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u9879\u4e0e\u65b0\u7248\u672c\u517c\u5bb9\u3002<\/li>\n<\/ul>\n<p><h3>3. \u7cfb\u7edf\u8def\u5f84\u548c\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u786e\u4fdd\u65b0\u5b89\u88c5\u7684Python\u7248\u672c\u88ab\u6b63\u786e\u6dfb\u52a0\u5230\u7cfb\u7edf\u8def\u5f84\u4e2d\u3002<\/p>\n<\/p>\n<ul>\n<li>\u68c0\u67e5<code>$PATH<\/code>\u73af\u5883\u53d8\u91cf\uff0c\u786e\u8ba4\u65b0\u7248\u672c\u7684Python\u5728\u5176\u4e2d\u3002<\/li>\n<li>\u4f7f\u7528<code>which python<\/code>\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u4f7f\u7528\u7684Python\u89e3\u91ca\u5668\u8def\u5f84\u3002<\/li>\n<\/ul>\n<p><p>\u603b\u7ed3\u6765\u8bf4\uff0c<strong>\u5347\u7ea7Python\u7684\u6700\u4f73\u65b9\u6cd5\u662f\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u6216pyenv<\/strong>\uff0c\u56e0\u4e3a\u5b83\u4eec\u80fd\u591f\u7b80\u5316\u7248\u672c\u7ba1\u7406\u5e76\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\u3002\u624b\u52a8\u7f16\u8bd1\u9002\u5408\u9700\u8981\u6700\u65b0\u6216\u7279\u5b9a\u7248\u672c\u7684\u9ad8\u7ea7\u7528\u6237\u3002\u65e0\u8bba\u54ea\u79cd\u65b9\u6cd5\uff0c\u90fd\u8981\u786e\u4fdd\u5728\u5347\u7ea7\u524d\u505a\u597d\u5907\u4efd\u548c\u6d4b\u8bd5\uff0c\u4ee5\u786e\u4fdd\u9879\u76ee\u7684\u7a33\u5b9a\u6027\u548c\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5\u5f53\u524dLinux\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684Python\u7248\u672c\uff1f<\/strong><br \/>\u8981\u67e5\u770b\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\uff0c\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>python --version<\/code> \u6216 <code>python3 --version<\/code>\u3002\u8fd9\u5c06\u663e\u793a\u7cfb\u7edf\u4e2d\u9ed8\u8ba4Python\u7248\u672c\u7684\u4fe1\u606f\u3002\u5982\u679c\u60a8\u540c\u65f6\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u76f8\u5e94\u7684\u547d\u4ee4\u6765\u68c0\u67e5\u7279\u5b9a\u7248\u672c\u3002<\/p>\n<p><strong>\u5728Linux\u7cfb\u7edf\u4e2d\u5982\u4f55\u5b89\u88c5\u65b0\u7684Python\u7248\u672c\uff1f<\/strong><br \/>\u8981\u5b89\u88c5\u65b0\u7684Python\u7248\u672c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u4f8b\u5982\u5728Debian\/Ubuntu\u7cfb\u7edf\u4e2d\u4f7f\u7528<code>apt<\/code>\u547d\u4ee4\uff1a<code>sudo apt update<\/code> \u548c <code>sudo apt install python3.x<\/code>\uff08\u5c06x\u66ff\u6362\u4e3a\u60a8\u60f3\u5b89\u88c5\u7684\u5177\u4f53\u7248\u672c\u53f7\uff09\u3002\u5bf9\u4e8e\u57fa\u4e8eRed Hat\u7684\u7cfb\u7edf\uff0c\u4f7f\u7528<code>yum<\/code>\u547d\u4ee4\u3002\u60a8\u4e5f\u53ef\u4ee5\u9009\u62e9\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u5b89\u88c5\uff0c\u5177\u4f53\u6b65\u9aa4\u5305\u62ec\u4e0b\u8f7d\u6e90\u4ee3\u7801\u3001\u89e3\u538b\u7f29\u4ee5\u53ca\u8fd0\u884c<code>.\/configure<\/code>\u3001<code>make<\/code>\u548c<code>make install<\/code>\u547d\u4ee4\u3002<\/p>\n<p><strong>\u5347\u7ea7Python\u540e\uff0c\u5982\u4f55\u5904\u7406\u73b0\u6709\u7684Python\u73af\u5883\u548c\u5e93\uff1f<\/strong><br \/>\u5347\u7ea7Python\u7248\u672c\u540e\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u66f4\u65b0\u548c\u7ba1\u7406\u73b0\u6709\u7684\u865a\u62df\u73af\u5883\u548c\u5e93\u3002\u4f7f\u7528<code>pip list<\/code>\u547d\u4ee4\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u5e93\uff0c\u5e76\u4f7f\u7528<code>pip install --upgrade &lt;package-name&gt;<\/code>\u547d\u4ee4\u9010\u4e2a\u66f4\u65b0\u5e93\u3002\u6b64\u5916\uff0c\u8003\u8651\u4f7f\u7528<code>virtualenv<\/code>\u6216<code>conda<\/code>\u7b49\u5de5\u5177\u6765\u521b\u5efa\u9694\u79bb\u7684\u73af\u5883\uff0c\u4ee5\u907f\u514d\u4e0e\u7cfb\u7edf\u5e93\u53d1\u751f\u51b2\u7a81\u3002\u5bf9\u4e8e\u4f9d\u8d56\u4e8e\u65e7\u7248\u672cPython\u7684\u9879\u76ee\uff0c\u786e\u4fdd\u6d4b\u8bd5\u5b83\u4eec\u5728\u65b0\u7248\u672c\u4e2d\u7684\u517c\u5bb9\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Linux\u4e0a\u5347\u7ea7Python\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\uff1a\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u66f4\u65b0\u3001\u624b\u52a8\u7f16\u8bd1\u5b89\u88c5\u3001\u4f7f\u7528pyenv\u7ba1\u7406\u591a\u4e2a\u7248\u672c\u3002 [&hellip;]","protected":false},"author":3,"featured_media":945099,"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\/945097"}],"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=945097"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/945097\/revisions"}],"predecessor-version":[{"id":945100,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/945097\/revisions\/945100"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/945099"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=945097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=945097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=945097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}