728x90 반응형 SMALL centOS 7 리눅스에는 기본적으로 파이썬 2.7이 설치되어 있다. 아래 명령어로 파이썬 버전을 확인할 수 있다.
이를 최신버전으로 바꿔서 설치해본다. 루트계정으로 로그인해서 아래 명령어 실행한다. 이는 파이썬 설치에 필요한 각종 플로그인을 다운받는다. gcc는 gnu 컴파일러 모음을 의미한다. openssl-devel은 웹브라우저와 서버 간의 통신을 암호화하는 오픈소스 라이브러리이다. bzip2-devel은 압축프로그램중 하나이다 libffi-devel은 인터프리터언어와 컴파일 언어 연결해주는 라이브러리이다. 뒤에 -devel은 컴파일을 위한 라이브러리 패키지이다.
그리고 아래 파이썬 사이트에가서 최신버전을 설치한다. https://www.python.org/downloads/ 아래 네모부분 링크복사한다. 아래 명령어 실행
그리고 압축을 풀어준다.
이제 파이썬 디렉토리로 들어가서 컴파일을 해준다.
컴파일을 마쳤으면 설치한다. 약 3분정도 걸리는 것 같다.
파이썬 3.9 바이너리 파일이 어디있는지 확인한다.
그리고 bash파일에 파이썬 별칭을 만든다.
source명령어로 적용시킨다.
이제 잘 적용되었는지 확인하기 위해 파이썬 버전을 출력해본다.
추가적으로 pip3를 설치하는 과정은 아래 글 참고~ https://earthconquest.tistory.com/224?category=888283 [Linux] Linux CentOS 7에 파이썬 pip3 설치하기 pip는 파이썬으로 작성된 패키지 라이브러리들을 관리해주는 시스템이다. 만약 yum이 안될 경우 업데이트를 해준다. [root@localhost ~]# yum update [root@localhost ~]# yum install epel-release //pip를 설치.. earthconquest.tistory.com 728x90 반응형 LIST 저작자표시동일조건 '데이터 엔지니어링 정복 > Python' 카테고리의 다른 글
I'm trying to install Python 3.9 an EC2 instance that uses Amazon Linux 2. I tried following this guide: https://computingforgeeks.com/install-latest-python-on-centos-linux/, and I was able to install Python3.9 manually on the EC2 instance by SSH'ing in and running the commands. I'm now trying to setup the EC2 instance with a UserData script that calls some CloudFormationInit scripts to install dependencies, including Python 3.9, and my script is failing. Here's part of the script that I'm using to install Python 3.9:
I'm getting the following errors when trying to start up the EC2 instance:
Is there an easier way to install Python 3.9 on Amazon Linux 2 using CloudFormationInit? |