pm2 특정 파이썬 버전으로 실행
pm2로 특정 파이썬 인터프리터 지정해 앱 실행함
pm2로 특정 파이썬 버전 앱 돌리기
어떤 파이썬 쓸지 경로 확인 먼저.
which python3.x
3.x 자리에 원하는 버전 넣음. 예: which python3.7
pm2로 앱 실행할 때 인터프리터 지정.
pm2 start [스크립트 파일] --interpreter=[파이썬 인터프리터 경로]
예시:
pm2 start app.py --interpreter=/usr/bin/python3.7
--name 플래그로 이름 지정 가능.
pm2 start horangApp_admin.py --interpreter=/usr/bin/python3.8 --name="hr_admin"
제대로 돌고 있는지 확인.
pm2 show [앱 이름]
프로세스 상세 정보 나옴. 사용된 인터프리터 경로도 확인 가능.
여기서 배울 것
- `which` 명령어로 파이썬 경로 찾기
- `pm2 start --interpreter` 플래그 사용법
- `--name`으로 pm2 프로세스 이름 지정
- `pm2 show`로 실행 인터프리터 확인
원본 파일 보기 (.claude/skills/tn-pm2-venv-execute/SKILL.md)
---
name: PM2 특정 Python 버전으로 실행
description: Use when the user asks to start a Python application with a specific Python interpreter version using PM2, or when they need to specify the Python executable path for a PM2 process.
version: 1.0.0
source: /home/son/prj/resume/backup_notes_260317/notion/Tech Note/pm2 venv execute c9bdf1d0b3be4825893183fa5b68b76b.md
---
# pm2 venv execute
using pm2, how can i start the program with specific python version?
1. **Locate the Python Version**: First, ensure that you know the path of the specific Python version you want to use. You can usually find this out by typing **`which python3.x`** in your terminal, where **`3.x`** is the version number. For example, for Python 3.7, you would use **`which python3.7`**.

2. **Start the Program with PM2**: Use the PM2 **`start`** command with the **`-interpreter`** flag to specify the path to the desired Python interpreter. The command would look something like this:
```css
cssCopy code
pm2 start your_script.py --interpreter=/path/to/specific/python
```
For example, if you're using Python 3.7 and your script is named **`app.py`**, the command might be:
```jsx
javascriptCopy code
pm2 start app.py --interpreter=/usr/bin/python3.7
```
Replace **`/usr/bin/python3.7`** with the actual path to the Python interpreter you found in the first step.
3. **Verify**: After starting the application, you can verify that it's running with the correct Python version by using:
```sql
sqlCopy code
pm2 show app
```
This will display detailed information about the process, including the interpreter being used.
Remember to replace **`your_script.py`** with the path to your actual Python script and **`/path/to/specific/python`** with the actual path to the Python interpreter you wish to use.
Also, if your Python application requires specific arguments, you can append them at the end of the PM2 start command.
NAME program
pm2 start horangApp_admin.py --interpreter=/usr/bin/python3.8 **--name=”hr_admin”**