Python3 버전을 새로 깐 후에 기본 버전을 변경하니 Numpy가 설치되어있지 않았다. 따라서 Numpy를 설치하기 위해 pip3 install numpy
명령어를 실행 시 Failed building wheel for numpy등 여러 에러가 발생했다. 이 오류를 해결하기 위해 찾아본 결과 pip의 업그레이드가 필요하다는 얘기가 있었다.
💡 pip란?
파이썬으로 작성된 패키지 라이브러리를 설치 및 관리해주는 시스템. Ubuntu에서 apt-get, CentOS의 yum과 유사한 개념이다. 그냥 pip의 경우 python2 버전이고 python3 버전에 설치하기 위해서는 pip3를 사용해야 한다.
1
pip3 install --upgrade pip
위 명령어를 입력하니 pip3가 업그레이드가 되었고, 다시 pip3 install numpy
실행 시 경고문과 함께 설치가 되었다.
WARNING: The scripts f2py, f2py3 and f2py3.7 are installed in ‘/home/ubuntu/.local/bin’ which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use –no-warn-script-location.
따라서 vim ~/.bashrc
로 에디터를 열어서 아래 경로를 추가해 주었다.
1
export PATH=/home/ubuntu/.local/bin/:$PATH
참고자료
Stack overflow - How to upgrade pip3?
파이썬(PIP) numpy, pandas, matplotlib 설치 실패(에러) 해결 방법