컴공생의 다이어리

[Colab] 코랩 ValueError: unsupported pickle protocol: 5 오류 해결 - pickle(pkl) 파일 로드 본문

이것저것

[Colab] 코랩 ValueError: unsupported pickle protocol: 5 오류 해결 - pickle(pkl) 파일 로드

컴공 K 2021. 7. 26. 00:01

Colab 코랩 ValueError: unsupported pickle protocol: 5 오류 해결 - pickle(pkl) 파일 로드

구글의 colab에서 pickle 파일을 로드하다가 ValueError: unsupported pickle protocol: 5라는 오류가 발생해서 해결방법을 찾아보니 파이썬 버전을 바꾸는 방법과 아래에 정리한 방법이 있었는데 간단하게 아래방법으로 수행하는 것을 추천한다.


아래 명령어를 입력해 pickle5를 설치해준다.

!pip3 install pickle5

 

그리고 아래와 같은 형식을 사용해 pickle 파일을 로드해 줄 수 있다.

import pickle5 as pickle
with open('파일 경로 여기에 넣기', "rb") as fh:
  data = pickle.load(fh)

 

 

 

 

https://www.py4u.net/discuss/204546

 

Python 3.7 Error: Unsupported Pickle Protocol 5

Answer #3: In the event that you cannot load pickle5 because of its dependencies (mainly Visual Building c++), another solution could be that you change the Python interpreter you're using (to the old one, before the error occured). For me, I was getting t

www.py4u.net

 

728x90
Comments