python エラー「AttributeError: partially initialized module ‘xxx’ has no attribute ‘xxx’ (most likely due to a circular import)」が発生した場合の対処法
![python エラー「AttributeError: partially initialized module ‘xxx’ has no attribute ‘xxx’ (most likely due to a circular import)」が発生した場合の対処法](https://mebee.info/wp-content/uploads/2019/12/python.png)
pythonで、エラー「AttributeError: partially initialized module ‘xxx’ has no attribute ‘xxx’ (most likely due to a circular import)」が発生した場合の対処法を記述してます。pythonのバージョンは3.10.0を使用してます。
環境
- OS windows11 home 64bit
- python 3.10.0
エラー全文
以下のコードで発生
![](https://mebee.info/wp-content/uploads/2022/06/image-139.png)
エラー全文
arr = np.array([1.0, 2.0, 3.0, 4.0, 5.0])
AttributeError: partially initialized module 'numpy' has no attribute 'array' (most likely due to a circular import)
原因
ファイル名を「numpy.py」にしているため
対処法
「numpy」を使用したい場合は、別のファイル名にする
![](https://mebee.info/wp-content/uploads/2022/06/image-141.png)
-
前の記事
safari リーディングリストを開くショートカットキー 2023.03.14
-
次の記事
SourceTree 新規ブランチを作成するショートカットキー 2023.03.14
コメントを書く