最近写了一篇关于“微软开源分布式高性能GB框架LightGBM安装使用”的文章,有小伙伴安装Python环境遇到了问题。我个人也尝试安装了一下,确实遇到了很多问题。"Windows7下python的scipy库的安装"的问题解决后,又遇到“ImportError: cannot import name NUMPY_MKL”的问题。如下:

  1. D:\LightGBM\LightGBM\examples\python-guide>python simple_example.py
  2. Traceback (most recent call last):
  3. File "simple_example.py", line 4, in <module>
  4. import lightgbm as lgb
  5. File "D:\Python27\lib\site-packages\lightgbm-0.1-py2.7.egg\lightgbm\__init__.p
  6. y", line 9, in <module>
  7. from .basic import Dataset, Booster
  8. File "D:\Python27\lib\site-packages\lightgbm-0.1-py2.7.egg\lightgbm\basic.py",
  9. line 15, in <module>
  10. import scipy.sparse
  11. File "D:\Python27\lib\site-packages\scipy\__init__.py", line 61, in <module>
  12. from numpy._distributor_init import NUMPY_MKL  # requires numpy+mkl
  13. ImportError: cannot import name NUMPY_MKL

为什么会出现这样的问题呢?

参考“http://stackoverflow.com/questions/37267399/importerror-cannot-import-name-numpy-mkl”的说法是

由于我的“scipy”是按"Windows7下python的scipy库的安装"中的方法使用“.whl”文件安装的,而“numpy”是使用“pip install numpy”命令安装的。

其实我使用“pip install numpy”命令安装,实际上也是下载了一个“.whl”文件,只是和“scipy”的下载的源不一样,但是就不行了。

怎么办怎么办?

用命令“pip uninstall numpy”把numpy卸载了,用命令“pip uninstall mkl”把mkl卸载了

用和“scipy”同样的源,从“http://www.lfd.uci.edu/~gohlke/pythonlibs/”上下载“numpy”的安装文件(找到对应版本)

再用命令安装:pip install numpy‑1.14.2+mkl‑cp35‑cp35m‑win_amd64.whl(笔者是python3.5)

问题解决了。

Windows下Python安装: requires numpy+mkl 和ImportError: cannot import name NUMPY_MKL的更多相关文章

  1. Windows下Python安装numpy+mkl,Scipy和statsmodels

    最近做时间序列分析需要用到Python中的statsmodels,但是安装过程中遇到很头疼的问题,Google.Stackover各种都没有找到合适的解决办法,而且貌似还有很多同学也在吐槽Window ...

  2. windows下python安装Numpy、Scipy、matplotlib模块(转载)

    python下载链接     Numpy下载链接 python中Numpy包的安装及使用 Numpy包的安装 准备工作 Python安装 pip安装 将pip所在的文件夹添加到环境变量path路径中 ...

  3. windows下python安装Numpy、Scipy、matplotlib模块

    来源http://blog.csdn.net/Katrina_ALi/article/details/64922107 http://blog.csdn.net/qq_16633405/article ...

  4. windows下python安装paramiko

    Python中使用SSH需要用到OpenSSH,而OpenSSH依赖于paramiko模块,而paramiko模块又依赖于pycrypto模块,因此要在Python中使用SSH,则需要先安装模块顺序是 ...

  5. windows下python安装uwsgi

    1.使用pip安装 pip install uwsgi 报错:os没有uname() 解决: 定位到uwsgiconfig.py文件中,首先import platform后,将os.unam()都改为 ...

  6. python机器学习包 Windows下 pip安装 scikit-learn numpy scipy

    1.到PIP的目录中C:\Python34\Scripts;2. 2.1  pip安装numpy pip install numpy 2.2  pip安装sklearn pip install -U ...

  7. windows下python安装Numpy和Scipy模块

    安装 numpy: 去 http://sourceforge.net/projects/numpy/files/latest/download?source=files 下载相应的exe安装文件. 安 ...

  8. Windows下python安装matplotlib

    此文为转载,原文地址为:http://blog.csdn.net/u010585135/article/details/42127273 一.下载matplotlib安装包:网址http://matp ...

  9. Windows下Python安装lxml

    1.下载easy_install的安装包,下载地址:https://pypi.Python.org/pypi/setuptools 我是Windows7,所以直接下载Windows(Simplify) ...

随机推荐

  1. mysqldump 导出数据库各参数详细说明

    mysqldump是mysql用于转存储数据库的实用程序.它主要产生一个SQL脚本,其中包含从头重新创建数据库所必需的命令CREATE TABLE INSERT等. 下面我们详细介绍一下mysqldu ...

  2. 关于document的节点;用Dom2创建节点;

    一.关于节点 1.节点树状图 document>documentElement>body>tagName 2.节点类型 元素节点(标签).文本节点(文本).属性节点(标签属性) 3. ...

  3. 9.11 h5日记

      9.11   超链接标签<a></a>十分特殊改a标签内容的字体颜色,必须是直接给a 设置,给它的父级标签设置是不可行的.   PS:什么是属性继承,即父级标签设置的样式后 ...

  4. String 练习

    package com.hanqi; import java.util.Random; public class Text { public static void main(String[] arg ...

  5. 设置漂亮的eclipse主题(Theme)风格

    看看这些主题: Eclipse Color Themes 设置步骤: 1.点击help --> Eclipse Marketplace... 2.搜索Color Eclipse Themes 3 ...

  6. iOS.XcodeUsage

    1. Customizing Xcode File Templates http://blog.highorderbit.com/2009/03/15/customizing-xcode-cocoa- ...

  7. div同时使用两个class

    <p class="con hide">...</p> 1:使用空格分割 2:这个段落将同时应用这两个 class 制定的规则 3:如果二者有重叠,后者覆盖 ...

  8. [ES]elasticsearch章4 ES的META们

    在介绍Meta更新流程前,我们先介绍一下ES中Meta的组成.存储方式和恢复方式. 1. Meta:ClusterState.MetaData.IndexMetaData Meta是用来描述数据的数据 ...

  9. IntelliJ IDEA 配置svn

    1.启用版本控制 2.在弹出的框中选择svn 3.下载并解压VisualSVN  下载地址:http://subversion.apache.org/packages.html#windows 4.i ...

  10. linux 查看信息-服务器相关

    查看系统内核 查看磁盘信息 查看CPU的信息 查看内存相关信息