{"id":1128755,"date":"2025-01-08T20:23:28","date_gmt":"2025-01-08T12:23:28","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1128755.html"},"modified":"2025-01-08T20:23:31","modified_gmt":"2025-01-08T12:23:31","slug":"python%e5%ae%89%e8%a3%85%e6%97%b6%e5%8f%91%e7%94%9f%e4%b8%a5%e9%87%8d%e9%94%99%e8%af%af%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1128755.html","title":{"rendered":"python\u5b89\u88c5\u65f6\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u5982\u4f55\u89e3\u51b3"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25095349\/61d76bf2-c323-4330-8a17-905b6bf4733a.webp\" alt=\"python\u5b89\u88c5\u65f6\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u5982\u4f55\u89e3\u51b3\" \/><\/p>\n<p><p> <strong>\u5b89\u88c5Python\u65f6\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u7684\u5e38\u89c1\u89e3\u51b3\u65b9\u6848\u5305\u62ec\uff1a\u68c0\u67e5\u7cfb\u7edf\u517c\u5bb9\u6027\u3001\u66f4\u65b0\u7cfb\u7edf\u4f9d\u8d56\u3001\u4f7f\u7528\u6b63\u786e\u7684\u5b89\u88c5\u5305\u3001\u6e05\u7406\u65e7\u7248\u672c\u6587\u4ef6\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u7ba1\u7406\u5de5\u5177\u3001\u68c0\u67e5\u6743\u9650\u95ee\u9898\u3001\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\u3001\u91cd\u65b0\u4e0b\u8f7d\u5b89\u88c5\u5305\u3002\u8fd9\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u5e2e\u52a9\u4f60\u987a\u5229\u5b89\u88c5Python\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u89e3\u51b3Python\u5b89\u88c5\u65f6\u53d1\u751f\u7684\u4e25\u91cd\u9519\u8bef\u65f6\uff0c\u6700\u5e38\u89c1\u7684\u95ee\u9898\u4e4b\u4e00\u662f<strong>\u7cfb\u7edf\u517c\u5bb9\u6027\u95ee\u9898<\/strong>\u3002\u786e\u4fdd\u4f60\u4e0b\u8f7d\u7684Python\u7248\u672c\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u76f8\u5339\u914d\u662f\u5173\u952e\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u572864\u4f4d\u7cfb\u7edf\u4e0a\u5c1d\u8bd5\u5b89\u88c532\u4f4d\u7684Python\u7248\u672c\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u517c\u5bb9\u6027\u95ee\u9898\u3002\u8be6\u7ec6\u63cf\u8ff0\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><p><strong>\u7cfb\u7edf\u517c\u5bb9\u6027\u95ee\u9898<\/strong>\uff1a\u6bcf\u4e2aPython\u7248\u672c\u90fd\u6709\u5176\u7279\u5b9a\u7684\u7cfb\u7edf\u8981\u6c42\uff0c\u5305\u62ec\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u3001\u67b6\u6784\uff0832\u4f4d\u621664\u4f4d\uff09\u7b49\u3002\u786e\u4fdd\u4f60\u4e0b\u8f7d\u7684Python\u5b89\u88c5\u5305\u4e0e\u7cfb\u7edf\u7684\u7248\u672c\u548c\u67b6\u6784\u5339\u914d\u3002\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u662f64\u4f4d\u7684\uff0c\u90a3\u4e48\u6700\u597d\u9009\u62e964\u4f4d\u7684Python\u5b89\u88c5\u5305\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u4e00\u4e9b\u4e0d\u5fc5\u8981\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002\u6b64\u5916\uff0c\u67d0\u4e9b\u65e7\u7248\u672c\u7684\u64cd\u4f5c\u7cfb\u7edf\u53ef\u80fd\u4e0d\u518d\u53d7\u65b0\u7248\u672c\u7684Python\u652f\u6301\uff0c\u56e0\u6b64\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u5347\u7ea7\u64cd\u4f5c\u7cfb\u7edf\u6216\u9009\u62e9\u9002\u914d\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001\u68c0\u67e5\u7cfb\u7edf\u517c\u5bb9\u6027<\/h3>\n<\/p>\n<p><p>\u5728\u5b89\u88c5Python\u65f6\uff0c\u7cfb\u7edf\u517c\u5bb9\u6027\u662f\u9996\u8981\u8003\u8651\u56e0\u7d20\u3002\u786e\u4fdd\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u548cPython\u7248\u672c\u76f8\u4e92\u517c\u5bb9\uff0c\u5426\u5219\u53ef\u80fd\u5bfc\u81f4\u5b89\u88c5\u5931\u8d25\u3002<\/p>\n<\/p>\n<p><h4>\u786e\u8ba4\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u8ba4\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u3002\u4f8b\u5982\uff0c\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u67e5\u770b\u7248\u672c\u4fe1\u606f\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6309\u4e0b <strong>Win + R<\/strong> \u952e\uff0c\u8f93\u5165 <strong>winver<\/strong>\uff0c\u6309 <strong>Enter<\/strong>\u3002<\/li>\n<li>\u5c06\u663e\u793a\u64cd\u4f5c\u7cfb\u7edf\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5982Windows\u7248\u672c\u53f7\u548c\u7248\u672c\u53f7\u3002<\/li>\n<\/ol>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">lsb_release -a<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">cat \/etc\/*release<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728macOS\u4e0a\uff0c\u4f60\u53ef\u4ee5\u70b9\u51fb <strong>Apple\u83dc\u5355 &gt; \u5173\u4e8e\u672c\u673a<\/strong>\uff0c\u67e5\u770b\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h4>\u5339\u914dPython\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u786e\u4fdd\u4f60\u4e0b\u8f7d\u7684Python\u7248\u672c\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u5339\u914d\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5bf9\u4e8e64\u4f4dWindows\u7cfb\u7edf\uff0c\u9009\u62e964\u4f4d\u7684Python\u5b89\u88c5\u5305\u3002<\/li>\n<li>\u5bf9\u4e8emacOS 10.15\u53ca\u4ee5\u4e0a\u7248\u672c\uff0c\u9009\u62e9\u6700\u65b0\u652f\u6301\u7684Python\u7248\u672c\u3002<\/li>\n<li>\u5bf9\u4e8eLinux\u7cfb\u7edf\uff0c\u9009\u62e9\u4e0e\u53d1\u884c\u7248\u76f8\u5339\u914d\u7684Python\u7248\u672c\uff0c\u5982Ubuntu 20.04\u4f7f\u7528Python 3.8\u6216\u66f4\u65b0\u7248\u672c\u3002<\/li>\n<\/ul>\n<p><h3>\u4e8c\u3001\u66f4\u65b0\u7cfb\u7edf\u4f9d\u8d56<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u7cfb\u7edf\u7f3a\u5c11\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u6216\u5e93\u4f1a\u5bfc\u81f4Python\u5b89\u88c5\u5931\u8d25\u3002\u66f4\u65b0\u7cfb\u7edf\u4f9d\u8d56\u9879\u53ef\u4ee5\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h4>Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u786e\u4fdd\u5b89\u88c5\u4e86\u6700\u65b0\u7684Windows\u66f4\u65b0\u548cMicrosoft Visual C++ Redistributable\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95eeWindows Update\u6765\u68c0\u67e5\u548c\u5b89\u88c5\u6700\u65b0\u66f4\u65b0\u3002\u6b64\u5916\uff0c\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7684Microsoft Visual C++ Redistributable\uff0c\u53ef\u4ee5\u89e3\u51b3\u4e0eC++\u5e93\u76f8\u5173\u7684\u4f9d\u8d56\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h4>Linux\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u66f4\u65b0\u7cfb\u7edf\u4f9d\u8d56\u9879\u3002\u4f8b\u5982\uff0c\u5728Debian\u7cfb\u7684\u64cd\u4f5c\u7cfb\u7edf\uff08\u5982Ubuntu\uff09\u4e0a\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt update<\/p>\n<p>sudo apt upgrade<\/p>\n<p>sudo apt install build-essential libssl-dev libffi-dev python3-dev<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728Red Hat\u7cfb\u7684\u64cd\u4f5c\u7cfb\u7edf\uff08\u5982CentOS\uff09\u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo yum update<\/p>\n<p>sudo yum upgrade<\/p>\n<p>sudo yum groupinstall &quot;Development Tools&quot;<\/p>\n<p>sudo yum install openssl-devel bzip2-devel libffi-devel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>macOS\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u4e0a\uff0c\u786e\u4fdd\u7cfb\u7edf\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\uff0c\u5e76\u5b89\u88c5Xcode Command Line Tools\u3002\u8fd9\u4e9b\u5de5\u5177\u5305\u62ec\u7f16\u8bd1\u5668\u548c\u5176\u4ed6\u5f00\u53d1\u5de5\u5177\uff0cPython\u5b89\u88c5\u9700\u8981\u8fd9\u4e9b\u5de5\u5177\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Xcode Command Line Tools\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">xcode-select --install<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u6b63\u786e\u7684\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u9009\u62e9\u6b63\u786e\u7684Python\u5b89\u88c5\u5305\u4e5f\u662f\u89e3\u51b3\u5b89\u88c5\u95ee\u9898\u7684\u5173\u952e\u3002\u5982\u679c\u4f60\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\u4e0d\u5b8c\u6574\u6216\u635f\u574f\uff0c\u4e5f\u4f1a\u5bfc\u81f4\u5b89\u88c5\u5931\u8d25\u3002<\/p>\n<\/p>\n<p><h4>\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d<\/h4>\n<\/p>\n<p><p>\u5efa\u8bae\u4ecePython\u5b98\u65b9\u5b98\u7f51\u4e0b\u8f7dPython\u5b89\u88c5\u5305\uff0c\u786e\u4fdd\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\u662f\u6700\u65b0\u4e14\u5b8c\u6574\u7684\u3002\u8bbf\u95ee\u4ee5\u4e0b\u7f51\u5740\uff1a<\/p>\n<\/p>\n<p><p><a href=\"https:\/\/www.python.org\/downloads\/\">Python\u5b98\u65b9\u4e0b\u8f7d\u9875\u9762<\/a><\/p>\n<\/p>\n<p><p>\u9009\u62e9\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u548c\u67b6\u6784\u7684\u5b89\u88c5\u5305\u8fdb\u884c\u4e0b\u8f7d\u3002<\/p>\n<\/p>\n<p><h4>\u6821\u9a8c\u5b89\u88c5\u5305<\/h4>\n<\/p>\n<p><p>\u4e0b\u8f7d\u540e\uff0c\u6821\u9a8c\u5b89\u88c5\u5305\u7684\u5b8c\u6574\u6027\u662f\u4e00\u4e2a\u597d\u4e60\u60ef\u3002\u5728Python\u4e0b\u8f7d\u9875\u9762\uff0c\u4f60\u53ef\u4ee5\u627e\u5230\u5b89\u88c5\u5305\u7684MD5\u6216SHA256\u6821\u9a8c\u503c\u3002\u4f7f\u7528\u6821\u9a8c\u5de5\u5177\u9a8c\u8bc1\u4e0b\u8f7d\u7684\u6587\u4ef6\u662f\u5426\u5b8c\u6574\u3002\u4f8b\u5982\uff0c\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sha256sum python-3.x.x.tgz<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u786e\u4fdd\u8f93\u51fa\u7684\u6821\u9a8c\u503c\u4e0ePython\u5b98\u7f51\u63d0\u4f9b\u7684\u503c\u4e00\u81f4\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u6e05\u7406\u65e7\u7248\u672c\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u65e7\u7248\u672c\u7684Python\u6587\u4ef6\u548c\u914d\u7f6e\u4f1a\u5e72\u6270\u65b0\u7248\u672c\u7684\u5b89\u88c5\u3002\u6e05\u7406\u65e7\u7248\u672c\u6587\u4ef6\u53ef\u4ee5\u907f\u514d\u8fd9\u79cd\u5e72\u6270\u3002<\/p>\n<\/p>\n<p><h4>\u5378\u8f7d\u65e7\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7\u63a7\u5236\u9762\u677f\u5378\u8f7d\u65e7\u7248\u672c\u7684Python\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00 <strong>\u63a7\u5236\u9762\u677f &gt; \u7a0b\u5e8f\u548c\u529f\u80fd<\/strong>\u3002<\/li>\n<li>\u67e5\u627e\u5e76\u9009\u62e9\u65e7\u7248\u672c\u7684Python\uff0c\u70b9\u51fb <strong>\u5378\u8f7d<\/strong>\u3002<\/li>\n<\/ol>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5378\u8f7d\u65e7\u7248\u672c\u7684Python\u3002\u4f8b\u5982\uff0c\u5728Debian\u7cfb\u7cfb\u7edf\u4e0a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt remove python3.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728macOS\u4e0a\uff0c\u53ef\u4ee5\u624b\u52a8\u5220\u9664\u65e7\u7248\u672c\u7684Python\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u4e8e <strong>\/Library\/Frameworks\/Python.framework<\/strong> \u76ee\u5f55\u4e0b\u3002<\/p>\n<\/p>\n<p><h4>\u6e05\u7406\u6b8b\u7559\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5378\u8f7d\u540e\uff0c\u68c0\u67e5\u5e76\u5220\u9664\u6b8b\u7559\u7684Python\u6587\u4ef6\u548c\u914d\u7f6e\u3002\u4f8b\u5982\uff0c\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u68c0\u67e5\u4ee5\u4e0b\u76ee\u5f55\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>C:\\Users\\\u4f60\u7684\u7528\u6237\u540d\\AppData\\Local\\Programs\\Python<\/strong><\/li>\n<li><strong>C:\\Users\\\u4f60\u7684\u7528\u6237\u540d\\AppData\\Roaming\\Python<\/strong><\/li>\n<\/ul>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u68c0\u67e5\u4ee5\u4e0b\u76ee\u5f55\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>\/usr\/local\/lib\/python3.x<\/strong><\/li>\n<li><strong>\/usr\/local\/bin\/python3.x<\/strong><\/li>\n<\/ul>\n<p><p>\u5728macOS\u4e0a\uff0c\u68c0\u67e5\u4ee5\u4e0b\u76ee\u5f55\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>\/Library\/Frameworks\/Python.framework<\/strong><\/li>\n<li><strong>\/usr\/local\/bin\/python3.x<\/strong><\/li>\n<\/ul>\n<p><p>\u5220\u9664\u6b8b\u7559\u7684\u6587\u4ef6\u548c\u76ee\u5f55\uff0c\u4ee5\u786e\u4fdd\u65b0\u7248\u672c\u7684Python\u5b89\u88c5\u4e0d\u53d7\u5e72\u6270\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u7ba1\u7406\u5de5\u5177<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u865a\u62df\u73af\u5883\u7ba1\u7406\u5de5\u5177\u53ef\u4ee5\u9694\u79bb\u4e0d\u540c\u9879\u76ee\u7684\u4f9d\u8d56\uff0c\u907f\u514d\u4f9d\u8d56\u51b2\u7a81\u548c\u7248\u672c\u51b2\u7a81\u3002<\/p>\n<\/p>\n<p><h4>venv\u6a21\u5757<\/h4>\n<\/p>\n<p><p>Python\u81ea\u5e26\u7684 <strong>venv<\/strong> \u6a21\u5757\u53ef\u4ee5\u521b\u5efa\u865a\u62df\u73af\u5883\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\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<ul>\n<li>\u5728Windows\u7cfb\u7edf\u4e0a\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-bash\">myenv\\Scripts\\activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li>\u5728Linux\u548cmacOS\u7cfb\u7edf\u4e0a\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-bash\">source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u548c\u7ba1\u7406\u4f9d\u8d56\uff0c\u4e0d\u4f1a\u5f71\u54cd\u7cfb\u7edf\u7684Python\u73af\u5883\u3002<\/p>\n<\/p>\n<p><h4>conda\u5de5\u5177<\/h4>\n<\/p>\n<p><p><strong>conda<\/strong> \u662f\u53e6\u4e00\u4e2a\u5f3a\u5927\u7684\u865a\u62df\u73af\u5883\u7ba1\u7406\u5de5\u5177\uff0c\u7279\u522b\u9002\u5408\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u3002\u4f60\u53ef\u4ee5\u4eceAnaconda\u6216Miniconda\u4e0b\u8f7d\u5e76\u5b89\u88c5conda\u3002<\/p>\n<\/p>\n<p><p>\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda create --name myenv python=3.x<\/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\">conda activate myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528conda\u7ba1\u7406\u865a\u62df\u73af\u5883\u548c\u4f9d\u8d56\uff0c\u53ef\u4ee5\u6709\u6548\u907f\u514d\u4f9d\u8d56\u51b2\u7a81\u548c\u5b89\u88c5\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u68c0\u67e5\u6743\u9650\u95ee\u9898<\/h3>\n<\/p>\n<p><p>\u6743\u9650\u95ee\u9898\u53ef\u80fd\u5bfc\u81f4Python\u5b89\u88c5\u5931\u8d25\uff0c\u7279\u522b\u662f\u5728Linux\u548cmacOS\u7cfb\u7edf\u4e0a\u3002\u786e\u4fdd\u4f60\u6709\u8db3\u591f\u7684\u6743\u9650\u6267\u884c\u5b89\u88c5\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><h4>Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u53ef\u4ee5\u89e3\u51b3\u6743\u9650\u95ee\u9898\u3002\u53f3\u952e\u70b9\u51fbPython\u5b89\u88c5\u7a0b\u5e8f\uff0c\u9009\u62e9 <strong>\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c<\/strong>\u3002<\/p>\n<\/p>\n<p><h4>Linux\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u4f7f\u7528 <strong>sudo<\/strong> \u63d0\u5347\u6743\u9650\u8fdb\u884c\u5b89\u88c5\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u6e90\u7801\u7f16\u8bd1\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo make install<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>macOS\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u4e0a\uff0c\u4f7f\u7528 <strong>sudo<\/strong> \u63d0\u5347\u6743\u9650\u8fdb\u884c\u5b89\u88c5\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo installer -pkg python-3.x.x-macosx.pkg -target \/<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u5b89\u88c5\u8fc7\u7a0b\u6709\u8db3\u591f\u7684\u6743\u9650\u8fdb\u884c\u6587\u4ef6\u5199\u5165\u548c\u914d\u7f6e\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u67e5\u770b\u5b89\u88c5\u65e5\u5fd7\u6587\u4ef6\u53ef\u4ee5\u5e2e\u52a9\u4f60\u627e\u5230\u5bfc\u81f4\u5b89\u88c5\u5931\u8d25\u7684\u5177\u4f53\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h4>Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e0a\uff0cPython\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u751f\u6210\u65e5\u5fd7\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u4e8e\u4e34\u65f6\u76ee\u5f55\u4e2d\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u627e\u5230\u65e5\u5fd7\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6309\u4e0b <strong>Win + R<\/strong> \u952e\uff0c\u8f93\u5165 <strong>%temp%<\/strong>\uff0c\u6309 <strong>Enter<\/strong>\u3002<\/li>\n<li>\u5728\u6253\u5f00\u7684\u4e34\u65f6\u6587\u4ef6\u5939\u4e2d\uff0c\u67e5\u627e\u4ee5 <strong>Python<\/strong> \u5f00\u5934\u7684\u65e5\u5fd7\u6587\u4ef6\u3002<\/li>\n<\/ol>\n<p><h4>Linux\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u68c0\u67e5\u7ec8\u7aef\u8f93\u51fa\u7684\u9519\u8bef\u4fe1\u606f\u3002\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u5305\u7ba1\u7406\u5668\u5b89\u88c5\uff0c\u53ef\u4ee5\u67e5\u770b\u5305\u7ba1\u7406\u5668\u7684\u65e5\u5fd7\u3002\u4f8b\u5982\uff0c\u5728Debian\u7cfb\u7cfb\u7edf\u4e0a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">cat \/var\/log\/apt\/term.log<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728Red Hat\u7cfb\u7cfb\u7edf\u4e0a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">cat \/var\/log\/yum.log<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>macOS\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u4e0a\uff0c\u68c0\u67e5\u7ec8\u7aef\u8f93\u51fa\u7684\u9519\u8bef\u4fe1\u606f\u3002\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662fGUI\u5b89\u88c5\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u5728\u5b89\u88c5\u7a0b\u5e8f\u7684 <strong>\u7a97\u53e3 &gt; \u5b89\u88c5\u65e5\u5fd7<\/strong> \u4e2d\u67e5\u770b\u65e5\u5fd7\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u91cd\u65b0\u4e0b\u8f7d\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\u53ef\u80fd\u635f\u574f\u6216\u4e0d\u5b8c\u6574\uff0c\u91cd\u65b0\u4e0b\u8f7d\u53ef\u4ee5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h4>\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d<\/h4>\n<\/p>\n<p><p>\u518d\u6b21\u8bbf\u95eePython\u5b98\u65b9\u5b98\u7f51\u4e0b\u8f7d\u6700\u65b0\u7684\u5b89\u88c5\u5305\uff0c\u786e\u4fdd\u4e0b\u8f7d\u8fc7\u7a0b\u4e0d\u53d7\u5e72\u6270\u3002\u8bbf\u95ee\u4ee5\u4e0b\u7f51\u5740\uff1a<\/p>\n<\/p>\n<p><p><a href=\"https:\/\/www.python.org\/downloads\/\">Python\u5b98\u65b9\u4e0b\u8f7d\u9875\u9762<\/a><\/p>\n<\/p>\n<p><p>\u9009\u62e9\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u548c\u67b6\u6784\u7684\u5b89\u88c5\u5305\u8fdb\u884c\u4e0b\u8f7d\u3002<\/p>\n<\/p>\n<p><h4>\u6821\u9a8c\u5b89\u88c5\u5305<\/h4>\n<\/p>\n<p><p>\u4e0b\u8f7d\u540e\uff0c\u518d\u6b21\u6821\u9a8c\u5b89\u88c5\u5305\u7684\u5b8c\u6574\u6027\uff0c\u786e\u4fdd\u4e0b\u8f7d\u7684\u6587\u4ef6\u6ca1\u6709\u635f\u574f\u3002\u4f7f\u7528\u4e4b\u524d\u63d0\u5230\u7684\u6821\u9a8c\u5de5\u5177\u9a8c\u8bc1\u4e0b\u8f7d\u7684\u6587\u4ef6\u3002<\/p>\n<\/p>\n<hr>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u6709\u6548\u5730\u89e3\u51b3Python\u5b89\u88c5\u65f6\u53d1\u751f\u7684\u4e25\u91cd\u9519\u8bef\u3002\u65e0\u8bba\u662f\u68c0\u67e5\u7cfb\u7edf\u517c\u5bb9\u6027\u3001\u66f4\u65b0\u7cfb\u7edf\u4f9d\u8d56\u3001\u4f7f\u7528\u6b63\u786e\u7684\u5b89\u88c5\u5305\u3001\u6e05\u7406\u65e7\u7248\u672c\u6587\u4ef6\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u7ba1\u7406\u5de5\u5177\u3001\u68c0\u67e5\u6743\u9650\u95ee\u9898\u3001\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\uff0c\u8fd8\u662f\u91cd\u65b0\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u8fd9\u4e9b\u6b65\u9aa4\u90fd\u80fd\u5e2e\u52a9\u4f60\u987a\u5229\u5b89\u88c5Python\uff0c\u786e\u4fdd\u5f00\u53d1\u73af\u5883\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u9760\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u786e\u5b9aPython\u5b89\u88c5\u65f6\u51fa\u73b0\u7684\u4e25\u91cd\u9519\u8bef\u7684\u5177\u4f53\u539f\u56e0\uff1f<\/strong><br \/>\u5728\u5b89\u88c5Python\u65f6\uff0c\u5982\u679c\u9047\u5230\u4e25\u91cd\u9519\u8bef\uff0c\u9996\u5148\u53ef\u4ee5\u67e5\u770b\u5b89\u88c5\u65e5\u5fd7\u6587\u4ef6\u3002\u8fd9\u4e9b\u65e5\u5fd7\u901a\u5e38\u4f1a\u63d0\u4f9b\u6709\u5173\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u9519\u8bef\u4ee3\u7801\u548c\u76f8\u5173\u6587\u4ef6\u3002\u68c0\u67e5\u7cfb\u7edf\u7684\u517c\u5bb9\u6027\uff0c\u786e\u4fdd\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u4e0ePython\u7248\u672c\u76f8\u7b26\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u5b89\u88c5\u7a0b\u5e8f\u5b8c\u6574\u65e0\u635f\uff0c\u5c1d\u8bd5\u91cd\u65b0\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/p>\n<p><strong>\u662f\u5426\u6709\u63a8\u8350\u7684\u89e3\u51b3\u65b9\u6848\u6765\u4fee\u590dPython\u5b89\u88c5\u5931\u8d25\u7684\u95ee\u9898\uff1f<\/strong><br \/>\u89e3\u51b3Python\u5b89\u88c5\u5931\u8d25\u7684\u95ee\u9898\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a1) \u5173\u95ed\u6240\u6709\u5176\u4ed6\u6b63\u5728\u8fd0\u884c\u7684\u7a0b\u5e8f\uff0c\u786e\u4fdd\u6ca1\u6709\u6587\u4ef6\u88ab\u5360\u7528\uff1b2) \u4ee5\u7ba1\u7406\u5458\u6743\u9650\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff1b3) \u4e34\u65f6\u7981\u7528\u9632\u706b\u5899\u6216\u6740\u6bd2\u8f6f\u4ef6\uff0c\u4ee5\u9632\u5b83\u4eec\u5e72\u6270\u5b89\u88c5\u8fc7\u7a0b\uff1b4) \u4f7f\u7528\u547d\u4ee4\u884c\u5b89\u88c5Python\uff0c\u624b\u52a8\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<p><strong>\u5728\u5b89\u88c5Python\u65f6\uff0c\u5982\u4f55\u907f\u514d\u5e38\u89c1\u7684\u9519\u8bef\uff1f<\/strong><br \/>\u4e3a\u4e86\u907f\u514d\u5728\u5b89\u88c5Python\u65f6\u51fa\u73b0\u5e38\u89c1\u9519\u8bef\uff0c\u5efa\u8bae\u63d0\u524d\u68c0\u67e5\u7cfb\u7edf\u7684\u9700\u6c42\u548c\u517c\u5bb9\u6027\u4fe1\u606f\u3002\u786e\u4fdd\u5b89\u88c5\u8def\u5f84\u6ca1\u6709\u7279\u6b8a\u5b57\u7b26\u6216\u7a7a\u683c\uff0c\u5e76\u5728\u5b89\u88c5\u65f6\u9009\u62e9\u201c\u6dfb\u52a0Python\u5230PATH\u201d\u9009\u9879\u3002\u6b64\u5916\uff0c\u4fdd\u6301\u7cfb\u7edf\u66f4\u65b0\uff0c\u786e\u4fdd\u6240\u6709\u5fc5\u8981\u7684\u4f9d\u8d56\u5305\u5df2\u5b89\u88c5\uff0c\u4e5f\u6709\u52a9\u4e8e\u987a\u5229\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5b89\u88c5Python\u65f6\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u7684\u5e38\u89c1\u89e3\u51b3\u65b9\u6848\u5305\u62ec\uff1a\u68c0\u67e5\u7cfb\u7edf\u517c\u5bb9\u6027\u3001\u66f4\u65b0\u7cfb\u7edf\u4f9d\u8d56\u3001\u4f7f\u7528\u6b63\u786e\u7684\u5b89\u88c5\u5305\u3001\u6e05\u7406\u65e7\u7248\u672c\u6587 [&hellip;]","protected":false},"author":3,"featured_media":1128765,"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\/1128755"}],"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=1128755"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1128755\/revisions"}],"predecessor-version":[{"id":1128766,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1128755\/revisions\/1128766"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1128765"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1128755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1128755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1128755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}