Traceback (most recent call last):
File "GovRpWordCloudv1.py", line 3, in <module>
import wordcloud
File "C:\Users\23645\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\wordcloud\__init__.py", line 1, in <module>
from .wordcloud import (WordCloud, STOPWORDS, random_color_func,
File "C:\Users\23645\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\wordcloud\wordcloud.py", line 19, in <module>
import matplotlib
File "C:\Users\23645\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\matplotlib\__init__.py", line 107, in <module>
from . import cbook, rcsetup
File "C:\Users\23645\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\matplotlib\cbook\__init__.py", line 28, in <module>
import numpy as np
File "D:\ex\numpy.py", line 18, in <module>
print(npSum())
File "D:\ex\numpy.py", line 11, in npSum
a = np.array([0, 1, 2, 3, 4])
AttributeError: partially initialized module 'numpy' has no attribute 'array' (most likely due to a circular import)
原因:
程序的文件夹里有numpy.py文件,修改文件名称即可正常使用。