多数组的初始化引发了未报告的异常python [英] initialization of multiarray raised unreported exception python

查看:180
本文介绍了多数组的初始化引发了未报告的异常python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名新程序员,正在学习python.我最近尝试学习有关使用numpy导入csv文件的信息. 这是我的代码:

I am a new programmer who is picking up python. I recently am trying to learn about importing csv files using numpy. Here is my code:

import numpy as np
x = np.loadtxt("abcd.py", delimiter = True, unpack = True)
print(x)

闲散的人给我回信:

>> True
>> Traceback (most recent call last):
>>  File "C:/Python34/Scripts/a.py", line 1, in <module>
    import numpy as np

>>  File "C:\Python34\lib\site-packages\numpy\__init__.py", line 180, in <module>
    from . import add_newdocs

>>  File "C:\Python34\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc

>>  File "C:\Python34\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
    from .type_check import *

>>  File "C:\Python34\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx

>>  File "C:\Python34\lib\site-packages\numpy\core\__init__.py", line 14, in <module>
    from . import multiarray

>> SystemError: initialization of multiarray raised unreported exception

为什么会出现此系统错误,我该如何解决?

Why do I get the this system error and how can I remedy it?

推荐答案

我也遇到了这个问题.这是由同一文件夹中名为"datetime.py"的文件(与 eg plot.py会调用我的datetime.py文件(我已经看到了我的datetime.py产生的输出,并且会自动在__pycache__文件夹中生成datetime.cpython-36.pyc.

I have experienced this problem too. This is cuased by a file named "datetime.py" in the same folder (exactly the same problem confronted by Bruce). Actually "datetime" is an existing python module. However, I do not know why running my own script, e.g. plot.py will invoke my datetime.py file (I have seen the output produced by my datetime.py, and there will be an auto-generated datetime.cpython-36.pyc in the __pycache__ folder).

尽管我不清楚如何触发错误,但是将我的datetime.py文件重命名为其他名称后,我可以立即运行plot.py.因此,建议您检查是否有一些文件名与系统模块冲突. (P.S.我使用Visual Studio Code运行python.)

Although I am not clear about how the error is triggered, after I rename my datetime.py file to other names, I can run the plot.py immediately. Therefore, I suggest you check if there are some files whose name collides with the system modules. (P.S. I use the Visual Studio Code to run python.)

这篇关于多数组的初始化引发了未报告的异常python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆