gpt4 book ai didi

python - Numpy 神秘地停止工作

转载 作者:行者123 更新时间:2023-12-01 04:40:37 24 4
gpt4 key购买 nike

我试图得到这个ConvexHull函数正在运行,我需要 numpy (我认为)才能让它工作。我将尝试卸载并重新安装 numpy,但我不确定为什么/如何发生这种情况,以便我可以防止它再次发生。

当我运行一些示例时,我决定从提示符处停止运行以节省一些输入。当我从文件中运行看似相同的代码时,它返回以下错误消息:

>>> 
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Python34/numpy.py", line 1, in <module>
from scipy.spatial import ConvexHull
File "C:\Python34\lib\site-packages\scipy\__init__.py", line 61, in <module>
from numpy import show_config as show_numpy_config
File "C:/Python34\numpy.py", line 1, in <module>
from scipy.spatial import ConvexHull
File "C:\Python34\lib\site-packages\scipy\spatial\__init__.py", line 90, in <module>
from .kdtree import *
File "C:\Python34\lib\site-packages\scipy\spatial\kdtree.py", line 8, in <module>
import scipy.sparse
File "C:\Python34\lib\site-packages\scipy\sparse\__init__.py", line 212, in <module>
from .base import *
File "C:\Python34\lib\site-packages\scipy\sparse\base.py", line 11, in <module>
from scipy._lib.six import xrange
File "C:\Python34\lib\site-packages\scipy\_lib\__init__.py", line 14, in <module>
from numpy.testing import Tester
ImportError: No module named 'numpy.testing'; 'numpy' is not a package
>>> ================================ RESTART ================================

现在,当我在提示符下输入 import numpy 时,它会返回:

>>> import numpy
Traceback (most recent call last):
File "<pyshell#40>", line 1, in <module>
import numpy
File "C:/Python34\numpy.py", line 1, in <module>
from scipy.spatial import ConvexHull
File "C:\Python34\lib\site-packages\scipy\__init__.py", line 61, in <module>
from numpy import show_config as show_numpy_config
ImportError: cannot import name 'show_config'

整个设置在几分钟前运行没有问题,我不确定为什么这一切都停止了。

我的命令全文是 here 。该文件很短,C:\Python34\numpy.py,包含以下内容:

from scipy.spatial import ConvexHull
import numpy as np
points = np.random.rand(30,2)

最佳答案

将文件名更改为与 numpy.py 不同的名称。

关于python - Numpy 神秘地停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30770221/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com