[파이썬] RuntimeError: The current Numpy installation…fails to pass a sanity check due to a bug in the windows runtime. 오류 처리하는 방법
파이썬으로 웹크롤링을하여 가져온 자료를 엑셀파일(xls)로 저장하기 위해 판다스(pandas) 모듈(라이브러리)을 설치 하고 난 후 엑셀로 출력하는 스크립트를 실행하였습니다. 하지만 기대했던 것과 달리 오류가 발생하였습니다.
파이썬 스크립트
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:\Users\ilike\AppData\Local\Programs\Python\Python39\python.exe C:/python/Workspace/main.py
16
Traceback (most recent call last):
File "C:\python\Workspace\main.py", line 33, in <module>
import pandas
File "C:\Users\ilike\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\__init__.py", line 11, in <module>
__import__(dependency)
File "C:\Users\ilike\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py", line 305, in <module>
_win_os_check()
File "C:\Users\ilike\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__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:\Users\ilike\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py", line 305, in <module>
_win_os_check()
File "C:\Users\ilike\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__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
>>>
pip 설치 명령어로 numpy 설치를 시도했습니다. 이미 설치가 되어있네요. numpy 1.19.4버전이 이미 설치되어 있습니다.
C:\Users\ilike>pip install numpy Requirement already satisfied: numpy in c:\users\ilike\appdata\local\programs\python\python39\lib\site-packages (1.19.4)
파이썬 스크립트 오류 해결방법
오류 원인은 버전이 너무 높았습니다. 그래서 설치된 numpy 버전을 1.19.3으로 다운그레이드하였습니다.
pip install numpy==1.19.3
C:\Users\ilike>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
[참고]
