Language/Python

파이썬 pip 패키지 다운그레이드

범데이 2021. 10. 19. 21:53

1. 개요

 

업비트에서 제공하는 웹소켓을 이용해서 실시간 가상화폐 정보를 조회하는 기능을 구현하는 중에,

pyupbit모듈이 필요로 하는 websockets 모듈의 버전이 높아 웹소켓 연결이 안되는 문제가 발생했다.

 

websockets 로컬 버전: 9.1 (정상 작동)

websockets 서버 버전: 10.0 (작동 X)

 

(base) PS C:\Users\Administrator> pip show websockets
Name: websockets
Version: 10.0
Summary: An implementation of the WebSocket Protocol (RFC 6455 & 7692)
Home-page: https://github.com/aaugustin/websockets
Author: Aymeric Augustin
Author-email: aymeric.augustin@m4x.org
License: BSD
Location: c:\programdata\anaconda3\lib\site-packages
Requires:
Required-by: pyupbit, pybithumb

 

2. 해결과정

websockets모듈의 버전을 낮춰주기 위해

아래와 같이 해당 모듈을 제거한 후, 버전명을 지정해주어 재 설치하였다.

(base) PS C:\Users\Administrator> pip uninstall websockets
Found existing installation: websockets 10.0
Uninstalling websockets-10.0:
  Would remove:
    c:\programdata\anaconda3\lib\site-packages\websockets-10.0.dist-info\*
    c:\programdata\anaconda3\lib\site-packages\websockets\*
Proceed (y/n)? y
  Successfully uninstalled websockets-10.0
  
  
(base) PS C:\Users\Administrator> pip install websockets==9.1
Collecting websockets==9.1
  Downloading websockets-9.1-cp38-cp38-win_amd64.whl (90 kB)
     |████████████████████████████████| 90 kB 990 kB/s
Installing collected packages: websockets
Successfully installed websockets-9.1

 

설치후 아래와 같이 확인:

(base) PS C:\Users\Administrator> pip show websockets
Name: websockets
Version: 9.1
Summary: An implementation of the WebSocket Protocol (RFC 6455 & 7692)
Home-page: https://github.com/aaugustin/websockets
Author: Aymeric Augustin
Author-email: aymeric.augustin@m4x.org
License: BSD
Location: c:\programdata\anaconda3\lib\site-packages
Requires:
Required-by: pyupbit, pybithumb

 

 

이렇게해서 로컬버전과 맞춰주니, 웹소켓 기능이 정상 작동하였다.

반응형