{"id":150442,"date":"2020-09-03T00:34:43","date_gmt":"2020-09-02T16:34:43","guid":{"rendered":"http:\/\/4563.org\/?p=150442"},"modified":"2020-09-03T00:34:43","modified_gmt":"2020-09-02T16:34:43","slug":"%e5%a6%82%e4%bd%95%e8%83%bd%e5%a4%9f%e8%8e%b7%e5%8f%96%e5%88%b0%e8%bf%9b%e7%a8%8b%e7%9a%84%e7%ac%ac%e4%b8%89%e6%96%b9%e6%a8%a1%e5%9d%97%e5%8c%85%e7%89%88%e6%9c%ac%e5%8f%b7%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=150442","title":{"rendered":"\u5982\u4f55\u80fd\u591f\u83b7\u53d6\u5230\u8fdb\u7a0b\u7684\u7b2c\u4e09\u65b9\u6a21\u5757\u5305\u7248\u672c\u53f7\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5982\u4f55\u80fd\u591f\u83b7\u53d6\u5230\u8fdb\u7a0b\u7684\u7b2c\u4e09\u65b9\u6a21\u5757\u5305\u7248\u672c\u53f7\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dwzhao <\/span>  <span><i><\/i> 14<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6700\u8fd1\u63a5\u4e86\u4e2a\u5de5\u4f5c<br \/>\u5185\u5bb9\u662f\uff1a\u5e0c\u671b\u80fd\u591f\u901a\u8fc7\u53d1\u6307\u4ee4\u7ed9\u5404\u4e2a\u5e94\u7528\u670d\u52a1\u53d1\u6d88\u606f\uff0c\u8ba9\u5404\u4e2a\u670d\u52a1\u6c47\u62a5\u81ea\u5df1\u4f7f\u7528\u7684\u7b2c\u4e09\u65b9\u5e93\u7248\u672c\u4fe1\u606f\u3002<br \/>\u76ee\u7684\uff1a\u80fd\u591f\u786e\u8ba4\u5404\u4e2a\u5e94\u7528\u7684\u7248\u672c\u53f7\uff0c\u65b9\u4fbf\u5b9e\u65f6\u67e5\u770b\u548c\u7ba1\u7406\u3002<br \/>\u80cc\u666f\uff1a\u5404\u4e2a\u670d\u52a1\u56e0\u4e3a\u542f\u52a8\u65f6\u95f4\u5f88\u65e9\u7684\u7f18\u6545\uff0c\u867d\u7136\u6240\u5728\u673a\u5668\u7684 requirement.txt \u5df2\u7ecf\u66f4\u65b0\uff0c\u4f46\u662f\u8fdb\u7a0b\u5185\u7684\u7b2c\u4e09\u65b9\u5e93\u7248\u672c\u8fd8\u662f\u65e7\u7684\uff0c\u4e00\u4e9b\u63a5\u53e3\u4e0d\u652f\u6301\u3002<\/p>\n<p>\u505a\u6cd5\uff1a<br \/>\u88ab\u5426\u51b3\u7684\u65b9\u6cd5\uff1a<br \/>1 \u3001\u67e5 requestment.txt \u548c\u542f\u52a8\u65f6\u95f4\uff0c\u8fd9\u4e2a\u81ea\u7531\u5ea6\u592a\u5927\u4e86\uff0c\u4e0d\u65b9\u4fbf\u3002<br \/>2 \u3001\u8ddf\u8fdb path \u4e2d\u7684\u4fe1\u606f\u6765\u67e5\u770b\u7248\u672c\u53f7\uff0c\u5b9e\u9645\u4e0a\u548c 1 \u4e00\u6837<br \/>3 \u3001\u4f7f\u7528\u7cfb\u7edf\u547d\u4ee4 pip list\uff0c\u865a\u62df\u73af\u5883\u4e0b\u7684\u8fdb\u7a0b\u600e\u4e48\u5904\u7406\uff1f<br \/>\u60f3\u5230\u7684\u65b9\u6cd5\uff1a<br \/>1 \u3001\u56e0\u4e3a\u662f\u8981\u67e5\u770b\u8fdb\u7a0b\u5185\u7684\u7b2c\u4e09\u65b9\u5e93\uff0c\u6240\u4ee5\u9700\u8981 import \u8fd9\u4e2a\u7b2c\u4e09\u65b9\u5e93\uff0c\u6bd4\u5982 import redis\uff0c\u8f93\u51fa\u5bf9\u5e94\u7684\u7248\u672c redis.__version__\uff0c\u8fd9\u6837\u505a\u4f1a\u6709\u4ec0\u4e48\u95ee\u9898\u4e48\uff0c\u6c42\u5404\u4f4d\u63d0\u63d0\u60f3\u6cd5\u548c\u5efa\u8bae~      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3006604\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/setuptools.readthedocs.io\/en\/latest\/pkg_resources.html#distribution-attributes                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3006605\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chinvo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             pip \u4e5f\u662f\u4e2a\u5305\uff0c\u53ef\u4ee5 import \u8fdb\u6765\u7528                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3006606\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 18870715400 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             import subprocess<br \/>pip_path = &#8220;~\/miniconda3\/bin\/pip&#8221;<br \/>res = subprocess.run(&#8220;{} list&#8221;.format(pip_path), shell=True, stdout=subprocess.PIPE)<br \/>infos = res.stdout<\/p>\n<p>\u7136\u540e\u5bf9 info \u5206\u5272\u53d6\u5305\u7684\u7248\u672c\u4fe1\u606f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3006607\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : dwzhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @18870715400 \u8fd9\u6837\u53ea\u662f\u8c03\u7528\u7cfb pip \u67e5\u770b\u5305\u7684\u7248\u672c\uff0c\u5e76\u4e0d\u4ee3\u8868\u8fdb\u7a0b\u5185\u7528\u7684\u5c31\u662f\u8fd9\u4e2a\u7248\u672c\u7684\u5305\u5440\u3002\u9664\u975e\u8ba9\u8fdb\u7a0b\u91cd\u542f\uff0c\u8fd9\u4e2a\u663e\u7136\u662f\u4e0d\u53ef\u80fd\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3006608\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : dwzhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @chinvo \u770b pip \u7684 doc \u91cc\u8bf4\uff1aEven though pip is available from your Python installation as an importable module, via import pip, it is not supported to use pip in this way. For more details, see Fixing conflicting dependencies.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3006609\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chinvo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @dwzhao #5 \u53ea\u662f pip \u5b98\u65b9\u4e0d\u63d0\u4f9b\u652f\u6301. \u800c\u4e14\u4ed6\u8bf4\u7684\u8fd9\u4e2a\u7528\u6cd5\u4e3b\u8981\u662f\u8fd0\u884c\u65f6\u5b89\u88c5\u65b0\u5305. \u53ea\u662f\u7528\u4e0b \u5217\u51fa\u5305 \u4e4b\u7c7b\u7684\u529f\u80fd, \u4e0d\u4f1a\u6709\u592a\u5927\u95ee\u9898\u7684.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3006610\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : dwzhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @chinvo\uff0c\u5b9e\u9645\u4e0a\u8fd9\u6837\u96be\u70b9\u5012\u4e0d\u662f\u5982\u4f55\u627e\u5230\u5305\u7684\u7248\u672c\uff0c\u800c\u662f\u786e\u8ba4\u8fdb\u7a0b\u4e2d\u5f15\u7528\u5230\u7684\u5305\u7684\u7248\u672c\uff0c\u540c\u65f6\u4e0d\u80fd\u56e0\u4e3a\u68c0\u67e5\u8fd9\u4e2a\u5305\u800c\u5f15\u5165\u8fd9\u4e2a\u5305\uff0c\u540c\u65f6\u4e5f\u4e0d\u613f\u610f\u53bb\u4e3b\u52a8 reload_model                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3006611\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : dwzhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528 pkg_resources \u6765\u67e5<br \/>&gt;&gt;&gt;import pkg_resources &gt;&gt;&gt; pkg_resources.get_distribution(&#8220;construct&#8221;).version &#8216;2.5.2&#8217;<\/p>\n<p>print([p.project_name,p.version for p in pkg_resources.working_set])                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3006612\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 18870715400 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @dwzhao \u4f60\u7684\u8fdb\u7a0b\u4f7f\u7528\u4e86\u54ea\u4e2a python \u73af\u5883\u5c31\u7528\u5bf9\u5e94\u73af\u5883\u7684 pip \u554a\uff0c \u4ec0\u4e48\u53eb\u505a&#8221;\u4e0d\u4ee3\u8868\u8fdb\u7a0b\u5185\u7528\u7684\u5c31\u662f\u8fd9\u4e2a\u7248\u672c\u7684\u5305&#8221;\uff0c\u96be\u9053\u4f60\u7684\u4e00\u4e2a\u73af\u5883\u540c\u4e00\u4e2a\u5305\u8fd8\u6709\u591a\u4e2a\u7248\u672c\u4e48\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u80fd\u591f\u83b7\u53d6\u5230\u8fdb\u7a0b\u7684\u7b2c\u4e09\u65b9\u6a21\u5757\u5305\u7248&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/150442"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=150442"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/150442\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=150442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=150442"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=150442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}