Importing the numpy C-extensions failed. This error can happen for many reasons

Importing the numpy C-extensions failed. This error can happen for many reasons

问题描述

在anaconda中创建虚拟环境,同一个环境在不同的代码下,一个能运行一个不能运行,不能运行的报错情况如下(因未及时保存,故借网上的同样报错情况的图),从网上找了一下,大致是python版本和numpy版本不匹配的原因造成的,但是我另一个代码正常运行,就挺头大的,所以不想改变环境导致另外一个能运行的运行不了,尝试其他不改变numpy版本的解决方法。
你好! 这是你第一次使用 **Markdown编辑器** 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。

解决方法

将该虚拟环境加入到环境变量中:
以我的虚拟环境为例:
在这里插入图片描述
将上述地址添加到环境变量中:
1.搜索框搜索“环境变量”,点击“编辑系统环境变量”:
在这里插入图片描述
2.系统变量中点击“Path”后点击“编辑”
在这里插入图片描述
3.点击“新建”,将地址复制到地址栏中,点击“确定”,继续点击确定,继续点击确定,一定要连续三次点击确定才能将地址加入到环境变量中!!!(可以重新打开验证一下是否添加成功)
在这里插入图片描述
4.之后运行代码,如果不行就重启一下pycharm再运行。
装环境真的好玄学,希望对大家有用。

Traceback (most recent call last): File "D:\python\lib\site-packages\numpy\core\__init__.py", line 23, in <module> from . import multiarray File "D:\python\lib\site-packages\numpy\core\multiarray.py", line 10, in <module> from . import overrides File "D:\python\lib\site-packages\numpy\core\overrides.py", line 8, in <module> from numpy.core._multiarray_umath import ( ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\neox_tools-master\neox_tools-master\onmyoji_converter.py", line 2, in <module> import numpy as np File "D:\python\lib\site-packages\numpy\__init__.py", line 139, in <module> from . import core File "D:\python\lib\site-packages\numpy\core\__init__.py", line 49, in <module> raise ImportError(msg) ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.8 from "D:\python\python.exe" * The NumPy version is: "1.25.0" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: No module named 'numpy.core._multiarray_umath'
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值