포시코딩

EC2 python 환경 만들기 본문

AWS/EC2

EC2 python 환경 만들기

포시 2022. 10. 27. 09:46
728x90

# python3 -> python

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10


# pip3 -> pip

sudo apt-get update
sudo apt-get install -y python3-pip
sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1

# port forwarding

sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 5000

# 백그라운드 실행

nohup python app.py &

# 서버 강제 종료

ps -ef | grep 'python app.py' | awk '{print $2}' | xargs kill

 

728x90