{"id":315,"date":"2017-08-09T16:03:03","date_gmt":"2017-08-09T08:03:03","guid":{"rendered":"http:\/\/zkeeer.space\/?p=315"},"modified":"2017-08-09T20:24:02","modified_gmt":"2017-08-09T12:24:02","slug":"python%e9%81%87%e5%88%b0%e9%94%99%e8%af%af%ef%bc%9aimporterror-cannot-import-name-numpy_mkl","status":"publish","type":"post","link":"http:\/\/zkeeer.space\/?p=315","title":{"rendered":"python\u9047\u5230\u9519\u8bef\uff1a\u201cImportError: cannot import name &#8216;NUMPY_MKL&#8217;\u201d"},"content":{"rendered":"<p><strong>\u9519\u8bef\u8be6\u60c5\u5982\u4e0b\uff1a<\/strong><\/p>\n<blockquote><p>Traceback (most recent call last):<br \/>\nFile &#8220;boids.py&#8221;, line 14, in<br \/>\nfrom scipy.spatial.distance import squareform, pdist, cdist<br \/>\nFile &#8220;C:\\Anaconda3\\lib\\site-packages\\scipy\\__init__.py&#8221;, line 61, in<br \/>\nfrom numpy._distributor_init import NUMPY_MKL # requires numpy+mkl<br \/>\nImportError: cannot import name &#8216;NUMPY_MKL&#8217;<\/p><\/blockquote>\n<p><strong>\u539f\u56e0\uff1a<\/strong><\/p>\n<p>If you look at the line which is causing the error, you&#8217;ll see this:<\/p>\n<pre><code>from numpy._distributor_init import NUMPY_MKL  # requires numpy+mkl\r\n<\/code><\/pre>\n<p>This line comment states the dependency as <code>numpy+mkl<\/code> (<code>numpy<\/code> with <a href=\"http:\/\/www.intel.com\/software\/products\/mkl\/\"><strong>Intel Math Kernel Library<\/strong><\/a>). This means that you&#8217;ve installed the <code>numpy<\/code> by <code>pip<\/code>, but the <code>scipy<\/code> was installed by precompiled archive, which expects <code>numpy+mkl<\/code>. \uff08\u51fa\u81eaStackOverflow\uff09<\/p>\n<p><strong>\u89e3\u51b3\u529e\u6cd5\uff1a<\/strong><\/p>\n<p>\u91cd\u65b0\u5b89\u88c5numpy+mkl\u7684whl\u6587\u4ef6\uff0c<a href=\"http:\/\/www.lfd.uci.edu\/~gohlke\/pythonlibs\/#numpy\">\u4ece\u8fd9\u91cc\u4e0b\u8f7d<\/a><\/p>\n<p><strong>\u7ed3\u679c\uff1a<\/strong>\u9a8c\u8bc1\u53ef\u884c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9519\u8bef\u8be6\u60c5\u5982\u4e0b\uff1a Traceback (m &hellip; <a href=\"http:\/\/zkeeer.space\/?p=315\" class=\"more-link\">More <span class=\"screen-reader-text\">python\u9047\u5230\u9519\u8bef\uff1a\u201cImportError: cannot import name &#8216;NUMPY_MKL&#8217;\u201d<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[11,13],"_links":{"self":[{"href":"http:\/\/zkeeer.space\/index.php?rest_route=\/wp\/v2\/posts\/315"}],"collection":[{"href":"http:\/\/zkeeer.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zkeeer.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zkeeer.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zkeeer.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=315"}],"version-history":[{"count":2,"href":"http:\/\/zkeeer.space\/index.php?rest_route=\/wp\/v2\/posts\/315\/revisions"}],"predecessor-version":[{"id":325,"href":"http:\/\/zkeeer.space\/index.php?rest_route=\/wp\/v2\/posts\/315\/revisions\/325"}],"wp:attachment":[{"href":"http:\/\/zkeeer.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zkeeer.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zkeeer.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}