python no module named numpy.distutils.core

有小伙伴在按照 微软开源分布式高性能GB框架LightGBM安装使用——Python  操作时,遇到错误:

no module named numpy.distutils.core

完整错误信息:

File "C:\soft\Python27\lib\site-packages\setuptools\command\easy_install.py",
line 665, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "C:\soft\Python27\lib\site-packages\setuptools\command\easy_install.py",
line 695, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "C:\soft\Python27\lib\site-packages\setuptools\command\easy_install.py",
line 876, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "C:\soft\Python27\lib\site-packages\setuptools\command\easy_install.py",
line 1115, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "C:\soft\Python27\lib\site-packages\setuptools\command\easy_install.py",
line 1101, in run_setup
    run_setup(setup_script, args)
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 251, in
run_setup
    raise
  File "C:\soft\Python27\lib\contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 198, in
setup_context
    yield
  File "C:\soft\Python27\lib\contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 169, in
save_modules
    saved_exc.resume()
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 144, in
resume
    six.reraise(type, exc, self._tb)
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 157, in
save_modules
    yield saved
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 198, in
setup_context
    yield
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 248, in
run_setup
    DirectorySandbox(setup_dir).run(runner)
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 278, in
run
    return func()
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 246, in
runner
    _execfile(setup_script, ns)
  File "C:\soft\Python27\lib\site-packages\setuptools\sandbox.py", line 47, in _
execfile
    exec(code, globals, locals)
  File "c:\users\admini~1\appdata\local\temp\easy_install-pm9mua\scipy-1.0.0\set
up.py", line 418, in 

  File "c:\users\admini~1\appdata\local\temp\easy_install-pm9mua\scipy-1.0.0\set
up.py", line 398, in setup_package

ImportError: No module named numpy.distutils.core
解决方法:
1、 使用“pip install numpy”命令安装 numpy

2、使用“pip install xgboost”命令安装 xgboost


I had the same problem today. I believe the issue is the instructions you listed are out of date for Python installs, as they are now enabled with pip install.

Delete the xgboost directory that your above install attempt created, and then execute:

pip install xgboost

It should all work with one command. See also the Python Specific XGBoost Install Instructions.

参考:https://stackoverflow.com/questions/35332300/importerror-no-module-named-numpy-distutils-core-ubuntu-xgboost-installation








你可能感兴趣的:(python no module named numpy.distutils.core)