[Python] 파이썬 오류처리 RuntimeError: The current Numpy installation…fails to pass a sanity check due to a bug in the windows runtime.
웹크롤링을 통하여 얻은 데이터를 엑셀파일로 저장하기위해 판다스(pandas) 모듈을 설치 후 엑셀로 출력하는 코드를 실행하였습니다. 그런데 기대했던 것과 달리 오류가 발생했어요. pandas 모듈을 import 후 사용하기 위해서는 numpy 모듈도 연관이 있는것 같네요. 실행코드와 오류 내용 그리고 해결방법에 대해 살펴봅니다.
실행코드
import pandas
# df = pandas.DataFrame(data_lst, columns=['뉴스제목', "기사 날짜", "URL", "이미지 URL"])
# writer = pandas.ExcelWriter("뉴스타파_기사.xlsx", engine="xlswriter")
# df.to_excel(writer, sheet_name="첫번째탭")
# writer.save()
#파일읽어오기
#df = pandas.read_csv("dfsdf.csv", encoding="EUC-KR") #, sep="t", header=None, names=['name','sdff']
#type(df['number'])
df = pandas.DataFrame(data_lst, columns=['뉴스제목', "기사 날짜", "URL", "이미지 URL"])
df.to_csv("test.csv")
오류내용
C:UsersilikeAppDataLocalProgramsPythonPython39python.exe C:/python/Workspace/main.py
16
Traceback (most recent call last):
File "C:pythonWorkspacemain.py", line 33, in <module>
import pandas
File "C:UsersilikeAppDataLocalProgramsPythonPython39libsite-packagespandas__init__.py", line 11, in <module>
__import__(dependency)
File "C:UsersilikeAppDataLocalProgramsPythonPython39libsite-packagesnumpy__init__.py", line 305, in <module>
_win_os_check()
File "C:UsersilikeAppDataLocalProgramsPythonPython39libsite-packagesnumpy__init__.py", line 302, in _win_os_check
raise RuntimeError(msg.format(__file__)) from None
RuntimeError: The current Numpy installation ('C:\Users\ilike\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
Process finished with exit code 1
Numpy모듈이 실행시 문제가 되는 것일까요??
혹시나 해서 numpy모듈을 import 해보았는데 동일한 오류가 발생되었다.
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
** On entry to DGEBAL parameter number 3 had an illegal value
** On entry to DGEHRD parameter number 2 had an illegal value
** On entry to DORGHR DORGQR parameter number 2 had an illegal value
** On entry to DHSEQR parameter number 4 had an illegal value
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:UsersilikeAppDataLocalProgramsPythonPython39libsite-packagesnumpy__init__.py", line 305, in <module>
_win_os_check()
File "C:UsersilikeAppDataLocalProgramsPythonPython39libsite-packagesnumpy__init__.py", line 302, in _win_os_check
raise RuntimeError(msg.format(__file__)) from None
RuntimeError: The current Numpy installation ('C:\Users\ilike\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
>>>
설치명령어를 실행해보았더니, 이미 설치가 되어있네요. numpy 1.19.4버전이 이미 설치되어 있습니다.
C:Usersilike>pip install numpy
Requirement already satisfied:
numpy in c:usersilikeappdatalocalprogramspythonpython39libsite-packages (1.19.4)
해결방법
설치된 numpy 버전을 1.19.3으로 다운그레이드하였습니다.
pip install numpy==1.19.3
C:Usersilike>pip install numpy==1.19.3
Collecting numpy==1.19.3
Downloading numpy-1.19.3-cp39-cp39-win_amd64.whl (13.3 MB)
|████████████████████████████████| 13.3 MB 6.4 MB/s
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.19.4
Uninstalling numpy-1.19.4:
Successfully uninstalled numpy-1.19.4
[REFERENCE]