{"id":1005097,"date":"2024-12-27T10:32:39","date_gmt":"2024-12-27T02:32:39","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1005097.html"},"modified":"2024-12-27T10:32:41","modified_gmt":"2024-12-27T02:32:41","slug":"anaconda%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85python%e5%ba%93","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1005097.html","title":{"rendered":"anaconda\u5982\u4f55\u5b89\u88c5python\u5e93"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25081752\/f0e3af95-4bb4-46ac-a119-c4f93f30239a.webp\" alt=\"anaconda\u5982\u4f55\u5b89\u88c5python\u5e93\" \/><\/p>\n<p><p> <strong>\u5b89\u88c5Anaconda Python\u5e93\u4e3b\u8981\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b8c\u6210\uff1a\u4f7f\u7528Anaconda Navigator\u6216conda\u547d\u4ee4\u884c\u3001\u521b\u5efa\u865a\u62df\u73af\u5883\u4ee5\u9694\u79bb\u9879\u76ee\u4f9d\u8d56\u3001\u4f7f\u7528pip\u5b89\u88c5\u975econda\u5e93\u3002<\/strong>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u5982\u4f55\u5728Anaconda\u4e2d\u5b89\u88c5Python\u5e93\uff0c\u4ee5\u53ca\u6bcf\u79cd\u65b9\u6cd5\u7684\u8be6\u7ec6\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528ANACONDA NAVIGATOR\u5b89\u88c5\u5e93<\/p>\n<\/p>\n<p><p>Anaconda Navigator\u662f\u4e00\u4e2a\u56fe\u5f62\u7528\u6237\u754c\u9762\uff0c\u5141\u8bb8\u7528\u6237\u8f7b\u677e\u7ba1\u7406Python\u5e93\u548c\u73af\u5883\u3002\u5b83\u9002\u5408\u90a3\u4e9b\u4e0d\u719f\u6089\u547d\u4ee4\u884c\u64cd\u4f5c\u7684\u4eba\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00Anaconda Navigator<\/strong><br \/>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86Anaconda\u3002\u6253\u5f00Anaconda Navigator\uff0c\u5728\u5de6\u4fa7\u83dc\u5355\u4e2d\u9009\u62e9\u201cEnvironments\u201d\u3002\u8fd9\u91cc\u4f60\u53ef\u4ee5\u770b\u5230\u5df2\u7ecf\u521b\u5efa\u7684\u865a\u62df\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9009\u62e9\u6216\u521b\u5efa\u73af\u5883<\/strong><br \/>\u9009\u62e9\u4f60\u8981\u5b89\u88c5\u5e93\u7684\u73af\u5883\uff0c\u5982\u679c\u6ca1\u6709\u5408\u9002\u7684\u73af\u5883\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u70b9\u51fb\u201cCreate\u201d\u6309\u94ae\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\u3002\u521b\u5efa\u65b0\u73af\u5883\u65f6\uff0c\u53ef\u4ee5\u6307\u5b9aPython\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u641c\u7d22\u5e76\u5b89\u88c5\u5e93<\/strong><br \/>\u5728\u9009\u5b9a\u73af\u5883\u7684\u7a97\u53e3\u4e2d\uff0c\u6709\u4e00\u4e2a\u201cSearch Packages\u201d\u641c\u7d22\u680f\u3002\u8f93\u5165\u4f60\u8981\u5b89\u88c5\u7684\u5e93\u540d\u79f0\uff0c\u7136\u540e\u70b9\u51fb\u641c\u7d22\u3002\u627e\u5230\u9700\u8981\u7684\u5e93\u540e\uff0c\u70b9\u51fb\u65c1\u8fb9\u7684\u590d\u9009\u6846\u5e76\u9009\u62e9\u201cApply\u201d\u4ee5\u5f00\u59cb\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528CONDA\u547d\u4ee4\u884c\u5b89\u88c5\u5e93<\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u719f\u6089\u547d\u4ee4\u884c\u7684\u7528\u6237\uff0c\u4f7f\u7528conda\u547d\u4ee4\u884c\u5de5\u5177\u5b89\u88c5\u5e93\u662f\u66f4\u4e3a\u76f4\u63a5\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u884c\u754c\u9762<\/strong><br \/>\u5728Windows\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u201c\u5f00\u59cb\u201d\u83dc\u5355\u627e\u5230\u5e76\u6253\u5f00\u201cAnaconda Prompt\u201d\u3002\u5728macOS\u6216Linux\u4e2d\uff0c\u53ef\u4ee5\u76f4\u63a5\u6253\u5f00\u7ec8\u7aef\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u73af\u5883<\/strong><br \/>\u5982\u679c\u4f60\u6709\u591a\u4e2a\u865a\u62df\u73af\u5883\uff0c\u9996\u5148\u9700\u8981\u6fc0\u6d3b\u4f60\u8981\u5b89\u88c5\u5e93\u7684\u73af\u5883\u3002\u4f7f\u7528\u547d\u4ee4<code>conda activate your_environment_name<\/code>\u6765\u6fc0\u6d3b\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u5e93<\/strong><br \/>\u4f7f\u7528\u547d\u4ee4<code>conda install package_name<\/code>\u6765\u5b89\u88c5\u5e93\u3002Cond\u4f1a\u81ea\u52a8\u89e3\u51b3\u4f9d\u8d56\u5173\u7cfb\u5e76\u4e0b\u8f7d\u76f8\u5e94\u7684\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u66f4\u65b0\u548c\u7ba1\u7406\u5e93<\/strong><br \/>\u4f60\u53ef\u4ee5\u4f7f\u7528<code>conda update package_name<\/code>\u6765\u66f4\u65b0\u5df2\u5b89\u88c5\u7684\u5e93\uff0c\u6216\u8005\u4f7f\u7528<code>conda list<\/code>\u67e5\u770b\u5f53\u524d\u73af\u5883\u4e2d\u7684\u6240\u6709\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528PIP\u5b89\u88c5\u975eCONDA\u5e93<\/p>\n<\/p>\n<p><p>\u6709\u4e9b\u5e93\u53ef\u80fd\u4e0d\u5728Conda\u7684\u5b98\u65b9\u4ed3\u5e93\u4e2d\uff0c\u8fd9\u65f6\u53ef\u4ee5\u4f7f\u7528pip\u6765\u5b89\u88c5\u8fd9\u4e9b\u5e93\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u786e\u4fdd\u73af\u5883\u6fc0\u6d3b<\/strong><br \/>\u786e\u4fdd\u4f60\u5df2\u7ecf\u6fc0\u6d3b\u4e86\u6b63\u786e\u7684\u865a\u62df\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528pip\u5b89\u88c5\u5e93<\/strong><br \/>\u4f7f\u7528\u547d\u4ee4<code>pip install package_name<\/code>\u6765\u5b89\u88c5\u5e93\u3002Pip\u4f1a\u4ecePython Package Index (PyPI)\u4e0b\u8f7d\u5e76\u5b89\u88c5\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ba1\u7406pip\u5e93<\/strong><br \/>\u4f7f\u7528<code>pip list<\/code>\u67e5\u770b\u6240\u6709\u5df2\u5b89\u88c5\u7684pip\u5e93\uff0c\u4f7f\u7528<code>pip uninstall package_name<\/code>\u6765\u5378\u8f7d\u4e0d\u9700\u8981\u7684\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u521b\u5efa\u865a\u62df\u73af\u5883\u4ee5\u9694\u79bb\u9879\u76ee\u4f9d\u8d56<\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u5e2e\u52a9\u4f60\u9694\u79bb\u4e0d\u540c\u9879\u76ee\u7684\u4f9d\u8d56\uff0c\u907f\u514d\u5e93\u7248\u672c\u51b2\u7a81\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong><br \/>\u4f7f\u7528\u547d\u4ee4<code>conda create --name myenv<\/code>\u6765\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amyenv\u7684\u865a\u62df\u73af\u5883\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7<code>conda create --name myenv python=3.8<\/code>\u6765\u6307\u5b9aPython\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong><br \/>\u4f7f\u7528<code>conda activate myenv<\/code>\u6fc0\u6d3b\u73af\u5883\u3002\u5728\u73af\u5883\u4e2d\u5b89\u88c5\u7684\u6240\u6709\u5e93\u90fd\u5c06\u4e0e\u5176\u4ed6\u73af\u5883\u9694\u79bb\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5220\u9664\u865a\u62df\u73af\u5883<\/strong><br \/>\u5982\u679c\u4f60\u4e0d\u518d\u9700\u8981\u67d0\u4e2a\u73af\u5883\uff0c\u53ef\u4ee5\u4f7f\u7528<code>conda remove --name myenv --all<\/code>\u6765\u5220\u9664\u5b83\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u7ba1\u7406\u73af\u5883\u7684\u4f9d\u8d56\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u65b9\u4fbf\u5728\u4e0d\u540c\u8bbe\u5907\u6216\u56e2\u961f\u6210\u5458\u4e4b\u95f4\u5171\u4eab\u73af\u5883\u914d\u7f6e\uff0c\u4f60\u53ef\u4ee5\u751f\u6210\u548c\u4f7f\u7528\u4f9d\u8d56\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u751f\u6210\u4f9d\u8d56\u6587\u4ef6<\/strong><br \/>\u5728\u6fc0\u6d3b\u7684\u73af\u5883\u4e2d\uff0c\u4f7f\u7528<code>conda env export &gt; environment.yml<\/code>\u547d\u4ee4\u751f\u6210\u4e00\u4e2ayml\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u73af\u5883\u7684\u6240\u6709\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u4f9d\u8d56\u6587\u4ef6\u521b\u5efa\u73af\u5883<\/strong><br \/>\u5728\u65b0\u8bbe\u5907\u4e0a\uff0c\u4f7f\u7528<code>conda env create -f environment.yml<\/code>\u547d\u4ee4\u53ef\u4ee5\u6839\u636e\u4f9d\u8d56\u6587\u4ef6\u521b\u5efa\u76f8\u540c\u7684\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u5728Anaconda\u4e2d\u6709\u6548\u5730\u5b89\u88c5\u548c\u7ba1\u7406Python\u5e93\u3002\u65e0\u8bba\u662f\u4f7f\u7528\u56fe\u5f62\u754c\u9762\u7684Anaconda Navigator\uff0c\u8fd8\u662f\u547d\u4ee4\u884c\u5de5\u5177Conda\u548cPip\uff0cAnaconda\u90fd\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u529f\u80fd\u6765\u7b80\u5316Python\u5f00\u53d1\u7684\u4f9d\u8d56\u7ba1\u7406\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Anaconda\u4e2d\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\u5e93\uff1f<\/strong><br \/>\u5728Anaconda\u4e2d\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u3002\u9996\u5148\uff0c\u6253\u5f00Anaconda Prompt\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>conda install package_name=version_number<\/code>\uff0c\u5c06<code>package_name<\/code>\u66ff\u6362\u4e3a\u4f60\u60f3\u8981\u5b89\u88c5\u7684\u5e93\u540d\uff0c<code>version_number<\/code>\u66ff\u6362\u4e3a\u6240\u9700\u7684\u7248\u672c\u53f7\u3002\u8fd9\u5c06\u786e\u4fdd\u4f60\u5b89\u88c5\u7684\u662f\u6b63\u786e\u7684\u7248\u672c\uff0c\u907f\u514d\u4e0e\u5176\u4ed6\u5e93\u4ea7\u751f\u51b2\u7a81\u3002<\/p>\n<p><strong>\u5728Anaconda\u4e2d\u5982\u4f55\u7ba1\u7406\u5df2\u5b89\u88c5\u7684Python\u5e93\uff1f<\/strong><br \/>\u7ba1\u7406\u5df2\u5b89\u88c5\u7684Python\u5e93\u53ef\u4ee5\u901a\u8fc7Anaconda Navigator\u6216\u547d\u4ee4\u884c\u5b8c\u6210\u3002\u5728Anaconda Navigator\u4e2d\uff0c\u9009\u62e9\u73af\u5883\u9009\u9879\u5361\uff0c\u70b9\u51fb\u6240\u9700\u73af\u5883\uff0c\u53ef\u4ee5\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u5e93\u53ca\u5176\u7248\u672c\u3002\u5728\u547d\u4ee4\u884c\u4e2d\uff0c\u8f93\u5165<code>conda list<\/code>\u53ef\u4ee5\u5217\u51fa\u6240\u6709\u5df2\u5b89\u88c5\u7684\u5e93\uff0c\u4f7f\u7528<code>conda remove package_name<\/code>\u53ef\u4ee5\u5378\u8f7d\u4e0d\u9700\u8981\u7684\u5e93\u3002<\/p>\n<p><strong>Anaconda\u5b89\u88c5Python\u5e93\u65f6\u51fa\u73b0\u4f9d\u8d56\u95ee\u9898\uff0c\u8be5\u600e\u4e48\u529e\uff1f<\/strong><br \/>\u5982\u679c\u5728\u5b89\u88c5Python\u5e93\u65f6\u51fa\u73b0\u4f9d\u8d56\u95ee\u9898\uff0c\u5efa\u8bae\u4f7f\u7528<code>conda install package_name --no-update-deps<\/code>\u547d\u4ee4\uff0c\u8fd9\u6837\u53ef\u4ee5\u5b89\u88c5\u5e93\u800c\u4e0d\u66f4\u65b0\u5df2\u6709\u7684\u4f9d\u8d56\u5305\u3002\u5982\u679c\u4f9d\u7136\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\uff0c\u53ef\u4ee5\u8003\u8651\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u73af\u5883\uff0c\u4f7f\u7528\u547d\u4ee4<code>conda create -n new_env_name python=3.x<\/code>\uff0c\u7136\u540e\u5728\u65b0\u73af\u5883\u4e2d\u5b89\u88c5\u6240\u9700\u5e93\uff0c\u4ee5\u907f\u514d\u4e0e\u73b0\u6709\u73af\u5883\u7684\u4f9d\u8d56\u51b2\u7a81\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5b89\u88c5Anaconda Python\u5e93\u4e3b\u8981\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b8c\u6210\uff1a\u4f7f\u7528Anaconda Navigator\u6216conda [&hellip;]","protected":false},"author":3,"featured_media":1005103,"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\/1005097"}],"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=1005097"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1005097\/revisions"}],"predecessor-version":[{"id":1005105,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1005097\/revisions\/1005105"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1005103"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1005097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1005097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1005097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}