{"id":978669,"date":"2024-12-27T06:39:42","date_gmt":"2024-12-26T22:39:42","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/978669.html"},"modified":"2024-12-27T06:39:44","modified_gmt":"2024-12-26T22:39:44","slug":"anaconda%e5%a6%82%e4%bd%95%e6%9b%b4%e6%8d%a2python%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/978669.html","title":{"rendered":"anaconda\u5982\u4f55\u66f4\u6362python\u7248\u672c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24203546\/83dbdb46-9716-4566-bd67-ad460c3b4d40.webp\" alt=\"anaconda\u5982\u4f55\u66f4\u6362python\u7248\u672c\" \/><\/p>\n<p><p> \u66f4\u6362Anaconda\u4e2d\u7684Python\u7248\u672c\u53ef\u4ee5\u901a\u8fc7<strong>\u521b\u5efa\u65b0\u7684\u73af\u5883\u3001\u4f7f\u7528conda\u547d\u4ee4\u66f4\u65b0Python\u7248\u672c\u3001\u521b\u5efa\u73af\u5883\u65f6\u6307\u5b9aPython\u7248\u672c<\/strong>\u7b49\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5176\u4e2d\u7684\u4e00\u79cd\u65b9\u6cd5\uff1a\u901a\u8fc7\u521b\u5efa\u65b0\u7684\u73af\u5883\u5e76\u6307\u5b9a\u6240\u9700\u7684Python\u7248\u672c\u6765\u8fdb\u884c\u66f4\u6362\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u5b89\u5168\uff0c\u800c\u4e14\u53ef\u4ee5\u907f\u514d\u5bf9\u73b0\u6709\u73af\u5883\u7684\u5f71\u54cd\u3002<\/p>\n<\/p>\n<p><p>\u5728Anaconda\u4e2d\uff0c\u521b\u5efa\u65b0\u7684\u73af\u5883\u5e76\u6307\u5b9aPython\u7248\u672c\u7684\u65b9\u6cd5\u662f\u975e\u5e38\u63a8\u8350\u7684\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u8ba9\u7528\u6237\u5728\u4e0d\u540c\u7684\u73af\u5883\u4e2d\u4f7f\u7528\u4e0d\u540c\u7684Python\u7248\u672c\u548c\u5e93\uff0c\u4ece\u800c\u4fdd\u8bc1\u9879\u76ee\u7684\u517c\u5bb9\u6027\u548c\u7a33\u5b9a\u6027\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u68c0\u67e5\u5f53\u524d\u7684Python\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u66f4\u6362Python\u7248\u672c\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u77e5\u9053\u5f53\u524d\u73af\u5883\u4e2d\u4f7f\u7528\u7684Python\u7248\u672c\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u68c0\u67e5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda list python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u663e\u793a\u5f53\u524d\u73af\u5883\u4e2d\u7684Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u66f4\u65b0Conda\u81f3\u6700\u65b0\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u8fdb\u884c\u4efb\u4f55\u64cd\u4f5c\u4e4b\u524d\uff0c\u786e\u4fddConda\u662f\u6700\u65b0\u7248\u672c\u3002\u66f4\u65b0Conda\u53ef\u4ee5\u907f\u514d\u5f88\u591a\u4e0d\u5fc5\u8981\u7684\u9519\u8bef\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u66f4\u65b0\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda update conda<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u521b\u5efa\u65b0\u7684Conda\u73af\u5883<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u65b0\u73af\u5883\u5e76\u6307\u5b9aPython\u7248\u672c<\/strong><\/p>\n<\/p>\n<p><p>\u8981\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Conda\u73af\u5883\uff0c\u5e76\u6307\u5b9a\u6240\u9700\u7684Python\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda create --name myenv python=3.8<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u91cc\u7684<code>myenv<\/code>\u662f\u65b0\u73af\u5883\u7684\u540d\u79f0\uff0c<code>python=3.8<\/code>\u6307\u5b9a\u4e86Python\u7684\u7248\u672c\u4e3a3.8\u3002\u7528\u6237\u53ef\u4ee5\u6839\u636e\u9700\u8981\u66f4\u6539Python\u7684\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u65b0\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u521b\u5efa\u73af\u5883\u540e\uff0c\u9700\u8981\u6fc0\u6d3b\u5b83\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda activate myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u6210\u529f\u540e\uff0c\u547d\u4ee4\u884c\u524d\u9762\u7684\u63d0\u793a\u7b26\u4f1a\u53d8\u4e3a\u73af\u5883\u7684\u540d\u79f0\uff0c\u8868\u660e\u5f53\u524d\u6b63\u5728\u4f7f\u7528\u8be5\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u5b89\u88c5\u6240\u9700\u7684\u5305<\/h3>\n<\/p>\n<p><p>\u5728\u65b0\u7684\u73af\u5883\u4e2d\uff0c\u7528\u6237\u53ef\u80fd\u9700\u8981\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u5305\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b9e\u73b0\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda install package_name<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u5b89\u88c5NumPy\u548cPandas\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda install numpy pandas<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u9a8c\u8bc1Python\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u65b0\u73af\u5883\u4e2d\uff0c\u7528\u6237\u53ef\u4ee5\u518d\u6b21\u68c0\u67e5Python\u7248\u672c\uff0c\u4ee5\u786e\u4fdd\u66f4\u6362\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u5176\u4ed6\u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u901a\u8fc7\u521b\u5efa\u65b0\u73af\u5883\u7684\u65b9\u6cd5\u5916\uff0c\u7528\u6237\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5728\u73b0\u6709\u73af\u5883\u4e2d\u66f4\u6362Python\u7248\u672c\u3002\u4f46\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u63a8\u8350\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u4f1a\u5bfc\u81f4\u517c\u5bb9\u6027\u95ee\u9898\u3002\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u53ef\u4ee5\u76f4\u63a5\u66f4\u6362Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda install python=3.8<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528Anaconda\u66f4\u6362Python\u7248\u672c\u7684\u8fc7\u7a0b\u76f8\u5bf9\u7b80\u5355\uff0c\u63a8\u8350\u901a\u8fc7<strong>\u521b\u5efa\u65b0\u7684\u73af\u5883\u5e76\u6307\u5b9aPython\u7248\u672c<\/strong>\u7684\u65b9\u6cd5\u6765\u5b9e\u73b0\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u80fd\u4fdd\u8bc1\u9879\u76ee\u7684\u72ec\u7acb\u6027\uff0c\u8fd8\u80fd\u907f\u514d\u4e0e\u73b0\u6709\u73af\u5883\u7684\u51b2\u7a81\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u591f\u5e2e\u52a9\u5230\u5728Anaconda\u4e2d\u8fdb\u884cPython\u7248\u672c\u66f4\u6362\u7684\u7528\u6237\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u7528\u6237\u53ef\u4ee5\u66f4\u7075\u6d3b\u5730\u7ba1\u7406\u4e0d\u540c\u7248\u672c\u7684Python\u548c\u5e93\uff0c\u4ece\u800c\u66f4\u597d\u5730\u5f00\u5c55\u6570\u636e\u79d1\u5b66\u9879\u76ee\u548c\u7814\u7a76\u5de5\u4f5c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Anaconda\u4e2d\u68c0\u67e5\u5f53\u524dPython\u7248\u672c\uff1f<\/strong><br \/>\u5728Anaconda\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00Anaconda Prompt\u5e76\u8f93\u5165<code>python --version<\/code>\u547d\u4ee4\u6765\u68c0\u67e5\u5f53\u524d\u4f7f\u7528\u7684Python\u7248\u672c\u3002\u8fd9\u5c06\u663e\u793a\u60a8\u5f53\u524d\u73af\u5883\u4e2d\u7684Python\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<p><strong>\u66f4\u6362Python\u7248\u672c\u540e\uff0c\u73af\u5883\u4e2d\u7684\u4f9d\u8d56\u4f1a\u53d7\u5230\u5f71\u54cd\u5417\uff1f<\/strong><br \/>\u66f4\u6362Python\u7248\u672c\u53ef\u80fd\u4f1a\u5f71\u54cd\u60a8\u7684\u73af\u5883\u4f9d\u8d56\u3002\u5982\u679c\u73af\u5883\u4e2d\u7684\u67d0\u4e9b\u5e93\u4e0d\u517c\u5bb9\u65b0\u7248\u672c\u7684Python\uff0c\u53ef\u80fd\u9700\u8981\u91cd\u65b0\u5b89\u88c5\u6216\u5347\u7ea7\u8fd9\u4e9b\u5e93\u3002\u5efa\u8bae\u5728\u66f4\u6362\u7248\u672c\u4e4b\u524d\u5907\u4efd\u73b0\u6709\u73af\u5883\uff0c\u4ee5\u4fbf\u5728\u51fa\u73b0\u95ee\u9898\u65f6\u53ef\u4ee5\u5feb\u901f\u6062\u590d\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Anaconda\u4e2d\u521b\u5efa\u4e00\u4e2a\u6307\u5b9aPython\u7248\u672c\u7684\u65b0\u73af\u5883\uff1f<\/strong><br \/>\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728Anaconda Prompt\u4e2d\u4f7f\u7528\u547d\u4ee4<code>conda create --name new_env_name python=3.x<\/code>\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u73af\u5883\uff0c\u5176\u4e2d<code>new_env_name<\/code>\u662f\u60a8\u60f3\u8981\u7684\u73af\u5883\u540d\u79f0\uff0c\u800c<code>3.x<\/code>\u662f\u60a8\u60f3\u8981\u5b89\u88c5\u7684Python\u7248\u672c\u3002\u521b\u5efa\u540e\uff0c\u4f7f\u7528<code>conda activate new_env_name<\/code>\u547d\u4ee4\u6fc0\u6d3b\u8be5\u73af\u5883\u3002<\/p>\n<p><strong>\u5728Anaconda\u4e2d\u66f4\u6362Python\u7248\u672c\u662f\u5426\u5f71\u54cd\u5168\u5c40\u73af\u5883\uff1f<\/strong><br \/>\u66f4\u6362Python\u7248\u672c\u901a\u5e38\u53ea\u4f1a\u5f71\u54cd\u60a8\u9009\u62e9\u7684\u7279\u5b9a\u73af\u5883\u3002\u5982\u679c\u60a8\u5728\u5168\u5c40\u73af\u5883\u4e2d\u66f4\u6539Python\u7248\u672c\uff0c\u53ef\u80fd\u4f1a\u5f71\u54cd\u6240\u6709\u4f7f\u7528\u8be5\u73af\u5883\u7684\u9879\u76ee\u3002\u56e0\u6b64\uff0c\u5efa\u8bae\u5728\u4e13\u7528\u7684\u865a\u62df\u73af\u5883\u4e2d\u8fdb\u884c\u7248\u672c\u66f4\u6362\uff0c\u4ee5\u907f\u514d\u5bf9\u5176\u4ed6\u9879\u76ee\u4ea7\u751f\u5f71\u54cd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u66f4\u6362Anaconda\u4e2d\u7684Python\u7248\u672c\u53ef\u4ee5\u901a\u8fc7\u521b\u5efa\u65b0\u7684\u73af\u5883\u3001\u4f7f\u7528conda\u547d\u4ee4\u66f4\u65b0Python\u7248\u672c\u3001\u521b\u5efa\u73af\u5883 [&hellip;]","protected":false},"author":3,"featured_media":978678,"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\/978669"}],"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=978669"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/978669\/revisions"}],"predecessor-version":[{"id":978683,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/978669\/revisions\/978683"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/978678"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=978669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=978669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=978669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}