{"id":984534,"date":"2024-12-27T07:29:02","date_gmt":"2024-12-26T23:29:02","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/984534.html"},"modified":"2024-12-27T07:29:09","modified_gmt":"2024-12-26T23:29:09","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8linux%e5%ae%89%e8%a3%85python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/984534.html","title":{"rendered":"\u5982\u4f55\u5728linux\u5b89\u88c5python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24212115\/d29994d9-c559-48bf-9dae-828c12b59fa8.webp\" alt=\"\u5982\u4f55\u5728linux\u5b89\u88c5python\" \/><\/p>\n<p><p> \u5728Linux\u4e0a\u5b89\u88c5Python\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u5177\u4f53\u6b65\u9aa4\u53ef\u80fd\u56e0Linux\u53d1\u884c\u7248\u7684\u4e0d\u540c\u800c\u6709\u6240\u5dee\u5f02\u3002<strong>\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528\u7cfb\u7edf\u5305\u7ba1\u7406\u5668\u3001\u4ece\u6e90\u7801\u7f16\u8bd1\u5b89\u88c5\u3001\u4f7f\u7528Pyenv\u7b49\u5de5\u5177<\/strong>\u3002\u5176\u4e2d\uff0c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u662f\u6700\u7b80\u5355\u548c\u63a8\u8350\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\u7684\u4e00\u79cd\uff1a\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><p><strong>\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u6cd5<\/strong>\u662f\u6700\u5e38\u7528\u7684\u5b89\u88c5Python\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3a\u5b83\u7b80\u5355\u5feb\u6377\uff0c\u5e76\u4e14\u53ef\u4ee5\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\u3002\u5bf9\u4e8e\u57fa\u4e8eDebian\u7684\u7cfb\u7edf\uff0c\u5982Ubuntu\uff0c\u4f7f\u7528<code>apt<\/code>\u547d\u4ee4\uff1b\u5bf9\u4e8e\u57fa\u4e8eRed Hat\u7684\u7cfb\u7edf\uff0c\u5982Fedora\uff0c\u4f7f\u7528<code>dnf<\/code>\u6216<code>yum<\/code>\u547d\u4ee4\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5Python<\/h3>\n<\/p>\n<p><p><strong>1\u3001\u57fa\u4e8eDebian\u7684\u7cfb\u7edf\uff08\u5982Ubuntu\uff09<\/strong><\/p>\n<\/p>\n<p><p>\u5728Ubuntu\u6216\u5176\u4ed6\u57fa\u4e8eDebian\u7684\u7cfb\u7edf\u4e0a\uff0c\u901a\u5e38\u9884\u88c5\u4e86<code>apt<\/code>\u5305\u7ba1\u7406\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt update<\/p>\n<p>sudo apt install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4ee5\u4e0a\u547d\u4ee4\u5c06\u5b89\u88c5Python 3\u7684\u6700\u65b0\u7248\u672c\u3002\u5982\u679c\u4f60\u9700\u8981\u5b89\u88c5\u7279\u5b9a\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528<code>python3.x<\/code>\u66ff\u6362<code>python3<\/code>\uff0c\u4f8b\u5982<code>python3.8<\/code>\u3002<\/p>\n<\/p>\n<p><p><strong>\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/strong><\/p>\n<\/p>\n<ul>\n<li><strong>\u66f4\u65b0\u5305\u5217\u8868<\/strong>\uff1a\u9996\u5148\uff0c\u901a\u8fc7<code>sudo apt update<\/code>\u547d\u4ee4\u66f4\u65b0\u5305\u5217\u8868\u3002\u8fd9\u4e00\u6b65\u786e\u4fdd\u4f60\u83b7\u53d6\u5230\u6700\u65b0\u7684\u53ef\u7528\u8f6f\u4ef6\u5305\u4fe1\u606f\u3002<\/li>\n<li><strong>\u5b89\u88c5Python<\/strong>\uff1a\u7136\u540e\uff0c\u4f7f\u7528<code>sudo apt install python3<\/code>\u547d\u4ee4\u5b89\u88c5Python 3\u3002\u5b89\u88c5\u8fc7\u7a0b\u4f1a\u81ea\u52a8\u89e3\u51b3\u4f9d\u8d56\u5173\u7cfb\uff0c\u5e76\u63d0\u793a\u4f60\u786e\u8ba4\u5b89\u88c5\u3002<\/li>\n<li><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7<code>python3 --version<\/code>\u547d\u4ee4\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\u53ca\u5176\u7248\u672c\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<p><p><strong>2\u3001\u57fa\u4e8eRed Hat\u7684\u7cfb\u7edf\uff08\u5982Fedora\u3001CentOS\uff09<\/strong><\/p>\n<\/p>\n<p><p>\u5bf9\u4e8eFedora\u6216CentOS\u7b49\u57fa\u4e8eRed Hat\u7684\u7cfb\u7edf\uff0c\u53ef\u4ee5\u4f7f\u7528<code>dnf<\/code>\u6216<code>yum<\/code>\u6765\u5b89\u88c5Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo dnf install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u5728\u8f83\u65e7\u7684\u7cfb\u7edf\u4e0a\u4f7f\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo yum install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a\u540c\u6837\u53ef\u4ee5\u4f7f\u7528<code>python3 --version<\/code>\u547d\u4ee4\u6765\u9a8c\u8bc1\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<p><h3>\u4e8c\u3001\u4ece\u6e90\u7801\u7f16\u8bd1\u5b89\u88c5Python<\/h3>\n<\/p>\n<p><p><strong>1\u3001\u4e0b\u8f7dPython\u6e90\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6240\u9700\u7248\u672c\u7684\u6e90\u7801\u538b\u7f29\u5305\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\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>\u5c06<code>3.x.x<\/code>\u66ff\u6362\u4e3a\u6240\u9700\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p><strong>2\u3001\u89e3\u538b\u6e90\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>tar<\/code>\u547d\u4ee4\u89e3\u538b\u4e0b\u8f7d\u7684\u6e90\u7801\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">tar -xvzf Python-3.x.x.tgz<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>3\u3001\u7f16\u8bd1\u548c\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>\u8fdb\u5165\u89e3\u538b\u540e\u7684\u6e90\u7801\u76ee\u5f55\uff0c\u914d\u7f6e\u7f16\u8bd1\u73af\u5883\u5e76\u5b89\u88c5\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<\/p>\n<p>sudo make altinstall<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><strong>\u914d\u7f6e\u7f16\u8bd1\u73af\u5883<\/strong>\uff1a<code>.\/configure --enable-optimizations<\/code>\u547d\u4ee4\u4f1a\u81ea\u52a8\u68c0\u67e5\u4f60\u7684\u7cfb\u7edf\uff0c\u5e76\u4e3a\u7f16\u8bd1Python\u505a\u597d\u51c6\u5907\u3002\u542f\u7528\u4f18\u5316\u9009\u9879\u53ef\u4ee5\u63d0\u9ad8Python\u7684\u6027\u80fd\u3002<\/li>\n<li><strong>\u7f16\u8bd1\u6e90\u7801<\/strong>\uff1a<code>make<\/code>\u547d\u4ee4\u7f16\u8bd1\u6e90\u7801\uff0c\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\u3002<\/li>\n<li><strong>\u5b89\u88c5Python<\/strong>\uff1a<code>sudo make altinstall<\/code>\u547d\u4ee4\u5b89\u88c5Python\u3002\u4f7f\u7528<code>altinstall<\/code>\u800c\u4e0d\u662f<code>install<\/code>\u662f\u4e3a\u4e86\u907f\u514d\u8986\u76d6\u7cfb\u7edf\u9ed8\u8ba4\u7684Python\u7248\u672c\u3002<\/li>\n<\/ul>\n<p><p><strong>4\u3001\u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>\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-bash\">python3.x --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c06<code>3.x<\/code>\u66ff\u6362\u4e3a\u5b89\u88c5\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528Pyenv\u5b89\u88c5Python<\/h3>\n<\/p>\n<p><p><strong>1\u3001\u5b89\u88c5Pyenv<\/strong><\/p>\n<\/p>\n<p><p>Pyenv\u662f\u4e00\u4e2a\u7528\u4e8e\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u7684\u5de5\u5177\u3002\u9996\u5148\uff0c\u5b89\u88c5Pyenv\u4f9d\u8d56\u9879\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt update<\/p>\n<p>sudo apt install -y build-essential curl libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u901a\u8fc7\u4ee5\u4e0b\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><strong>2\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<\/p>\n<p><p>\u7f16\u8f91<code>~\/.bashrc<\/code>\u6587\u4ef6\uff0c\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 virtualenv-init -)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u5e94\u7528\u914d\u7f6e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>3\u3001\u5b89\u88c5Python<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528Pyenv\u5b89\u88c5Python\u7684\u6307\u5b9a\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv install 3.x.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c06<code>3.x.x<\/code>\u66ff\u6362\u4e3a\u6240\u9700\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p><strong>4\u3001\u8bbe\u7f6e\u5168\u5c40Python\u7248\u672c<\/strong><\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u5168\u5c40\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv global 3.x.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>5\u3001\u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>\u6700\u540e\uff0c\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u5b89\u88c5\u540e\u914d\u7f6e\u548c\u5305\u7ba1\u7406<\/h3>\n<\/p>\n<p><p><strong>1\u3001\u5b89\u88c5pip<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u5e38\uff0cPython 3\u4f1a\u81ea\u5e26<code>pip<\/code>\uff0c\u8fd9\u662fPython\u7684\u5305\u7ba1\u7406\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u786e\u8ba4\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><p>\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\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><strong>2\u3001\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u7ba1\u7406\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u5efa\u8bae\u4f7f\u7528\u865a\u62df\u73af\u5883\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>3\u3001\u5b89\u88c5\u5e38\u7528Python\u5305<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>pip<\/code>\u5b89\u88c5\u5e38\u7528\u7684Python\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install numpy pandas matplotlib<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4ee5\u4e0a\u662f\u5982\u4f55\u5728Linux\u4e0a\u5b89\u88c5Python\u7684\u65b9\u6cd5\u3002\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u9002\u5408\u7684\u5b89\u88c5\u65b9\u5f0f\uff0c\u5e76\u6839\u636e\u5b9e\u9645\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u8c03\u6574\u3002\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u5728Linux\u4e0a\u6210\u529f\u5b89\u88c5\u548c\u914d\u7f6ePython\u73af\u5883\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Linux\u4e0a\u5b89\u88c5Python\u7684\u6b65\u9aa4\u662f\u600e\u6837\u7684\uff1f<\/strong><br \/>\u5728Linux\u4e0a\u5b89\u88c5Python\u901a\u5e38\u53ef\u4ee5\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u5b8c\u6210\u3002\u5927\u591a\u6570Linux\u53d1\u884c\u7248\u90fd\u9884\u88c5\u4e86Python\uff0c\u4f46\u5982\u679c\u9700\u8981\u5b89\u88c5\u7279\u5b9a\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a  <\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\u3002  <\/li>\n<li>\u4f7f\u7528\u9002\u5408\u60a8\u53d1\u884c\u7248\u7684\u5305\u7ba1\u7406\u5668\uff0c\u4f8b\u5982\u5728Ubuntu\u4e0a\u4f7f\u7528<code>apt<\/code>\uff0c\u5728CentOS\u4e0a\u4f7f\u7528<code>yum<\/code>\u3002\u4f8b\u5982\uff0c\u6267\u884c\u547d\u4ee4<code>sudo apt update<\/code>\uff0c\u7136\u540e\u8fd0\u884c<code>sudo apt install python3<\/code>\u6765\u5b89\u88c5Python 3\u3002  <\/li>\n<li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4<code>python3 --version<\/code>\u6765\u68c0\u67e5Python\u662f\u5426\u6210\u529f\u5b89\u88c5\u3002<\/li>\n<\/ol>\n<p><strong>\u5982\u4f55\u5728Linux\u4e0a\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\uff1f<\/strong><br \/>\u5982\u679c\u60a8\u9700\u8981\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pyenv<\/code>\u5de5\u5177\u3002\u8fd9\u4e2a\u5de5\u5177\u5141\u8bb8\u60a8\u8f7b\u677e\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u3002\u5b89\u88c5\u6b65\u9aa4\u5982\u4e0b\uff1a  <\/p>\n<ol>\n<li>\u5b89\u88c5<code>git<\/code>\u548c<code>curl<\/code>\uff1a<code>sudo apt install git curl<\/code>\u3002  <\/li>\n<li>\u4f7f\u7528\u547d\u4ee4<code>curl https:\/\/pyenv.run | bash<\/code>\u6765\u5b89\u88c5<code>pyenv<\/code>\u3002  <\/li>\n<li>\u66f4\u65b0\u60a8\u7684<code>~\/.bashrc<\/code>\u6216<code>~\/.bash_profile<\/code>\u6587\u4ef6\uff0c\u4ee5\u4fbf\u5728\u65b0\u7ec8\u7aef\u4e2d\u52a0\u8f7d<code>pyenv<\/code>\u3002  <\/li>\n<li>\u91cd\u65b0\u542f\u52a8\u7ec8\u7aef\uff0c\u4f7f\u7528\u547d\u4ee4<code>pyenv install &lt;version&gt;<\/code>\u5b89\u88c5\u6240\u9700\u7248\u672c\uff0c\u4f8b\u5982<code>pyenv install 3.9.1<\/code>\u3002<\/li>\n<\/ol>\n<p><strong>\u5b89\u88c5Python\u540e\uff0c\u6211\u5982\u4f55\u5b89\u88c5\u5e38\u7528\u7684\u7b2c\u4e09\u65b9\u5e93\uff1f<\/strong><br \/>\u5b89\u88c5Python\u540e\uff0c\u60a8\u53ef\u80fd\u4f1a\u9700\u8981\u4e00\u4e9b\u7b2c\u4e09\u65b9\u5e93\u6765\u652f\u6301\u60a8\u7684\u5f00\u53d1\u5de5\u4f5c\u3002\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u6765\u5b89\u88c5\u8fd9\u4e9b\u5e93\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u6b65\u9aa4\uff1a  <\/p>\n<ol>\n<li>\u786e\u4fdd<code>pip<\/code>\u5df2\u7ecf\u5b89\u88c5\uff0c\u8fd0\u884c\u547d\u4ee4<code>pip3 --version<\/code>\u6765\u68c0\u67e5\u3002  <\/li>\n<li>\u5982\u679c\u672a\u5b89\u88c5\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4<code>sudo apt install python3-pip<\/code>\u6765\u5b89\u88c5\u3002  <\/li>\n<li>\u4f7f\u7528\u547d\u4ee4<code>pip3 install &lt;library_name&gt;<\/code>\u5b89\u88c5\u6240\u9700\u7684\u5e93\uff0c\u4f8b\u5982<code>pip3 install requests<\/code>\u6765\u5b89\u88c5<code>requests<\/code>\u5e93\u3002<br \/>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5b89\u88c5\u548c\u7ba1\u7406Python\u5e93\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"\u5728Linux\u4e0a\u5b89\u88c5Python\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u5177\u4f53\u6b65\u9aa4\u53ef\u80fd\u56e0Linux\u53d1\u884c\u7248\u7684\u4e0d\u540c\u800c\u6709\u6240\u5dee\u5f02\u3002\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528 [&hellip;]","protected":false},"author":3,"featured_media":984553,"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\/984534"}],"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=984534"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/984534\/revisions"}],"predecessor-version":[{"id":984560,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/984534\/revisions\/984560"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/984553"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=984534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=984534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=984534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}