最近写了一篇关于“微软开源分布式高性能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. [leetcode]151. Reverse Words in a String翻转给定字符串中的单词

    Given an input string, reverse the string word by word. Example: Input: "the sky is blue", ...

  2. HelloWorld 基础语法

    所有内容取自菜鸟教程 public class HelloWorld {    /* 第一个Java程序     * 它将打印字符串 Hello World     */    public stat ...

  3. 关于Laravel框架

    第1讲-Laravel介绍 1.1 什么是Laravel laravel是目前一个比较主流的框架,现在很多互联网的公司都在使用该框架.该框架的前身是symfony框架 Laravel的定位就是做一个简 ...

  4. HTML基础学习笔记(2)

    HTML学习笔记(2) 1 head标签中的结构 编码结构:<meta charset="UTF-8"> charset---编码 ascll ansi Unicode ...

  5. 6-完美解决Error:SSL peer shut down incorrectly

    转载自: 完美解决Error:SSL peer shut down incorrectly 打开gradle文件夹下的gradle-wrapper文件 修改其中的配置文件将红色区域修改为http:// ...

  6. [z]libevent入门教程:Echo Server based on libevent 不指定

    [z]https://www.felix021.com/blog/read.php?2068 花了两天的时间在libevent上,想总结下,就以写简单tutorial的方式吧,貌似没有一篇简单的说明, ...

  7. Python 字符串(count)

    字符串 count:(python中的count()函数,从字面上可以知道,他具有统计功能) Python count() 方法用于统计字符串里某个字符出现的次数.可选参数为在字符串搜索的开始与结束位 ...

  8. 调试程序时如何用syslog来打印信息

    转自:https://www.cnblogs.com/vigarbuaa/archive/2013/02/05/2892544.html Linux下C语言编程的-把程序输出信息加到系统日志里去关键词 ...

  9. Lazarus下面的javascript绑定另外一个版本bug修正

    Lazarus下面的javascript绑定另外一个版本bug修正 从svn 检出的代码有几个问题 1.fpcjs.pas 单元开始有 {$IFDEF FPC} {$MODE delphi} {$EN ...

  10. maven mirror , profile , snapshot 和release

    1. settings.xml 配置的mirror <mirrors> <mirror> <id>Nexus</id> <name>nexu ...