python no module named numpy_python no module named numpy.distutils.core

当尝试安装scipy或xgboost时遇到'no module named numpy.distutils.core'错误。解决方案包括:1. 使用`pip install numpy`安装numpy;2. 删除之前安装失败的xgboost目录,然后执行`pip install xgboost`。参考Python特定的XGBoost安装指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值