SRankChatGpt/Presentation-Assistant
2
1import subprocess2import os3import sys4 5sys.path.append("/home/user/app") 6 7def env_set():8 # 패키지가 이미 설치되어 있는지 확인9 installed_packages = subprocess.check_output("pip list", shell=True).decode()10 11 if "PyPDF2" not in installed_packages:12 subprocess.run(f"pip install PyPDF2", shell=True)13 14 if "openai" not in installed_packages:15 subprocess.run(f"pip install -q openai", shell=True)16 17 if "python-pptx" not in installed_packages:18 subprocess.run(f"pip install python-pptx", shell=True)19 20 # pandoc 실행 권한 설정21 if not os.access("./pandoc-2.14.2/bin/pandoc", os.X_OK):22 subprocess.run(f"chmod +x ./pandoc-2.14.2/bin/pandoc", shell=True)23 24 # 디렉토리 권한 설정25 if not os.access(".", os.W_OK):26 subprocess.run(f"chmod -R 777 .", shell=True)27 28 # subprocess.run(f"wget https://github.com/jgm/pandoc/releases/download/2.14.2/pandoc-2.14.2-linux-amd64.tar.gz", shell=True)29 # subprocess.run(f"tar -xvf pandoc-2.14.2-linux-amd64.tar.gz", shell=True)30 # subprocess.run(f"wget https://nodejs.org/dist/v17.0.1/node-v17.0.1-linux-x64.tar.xz", shell=True)31 # subprocess.run(f"tar -xf node-v17.0.1-linux-x64.tar.xz", shell=True)32 # subprocess.run(f"mv node-v17.0.1-linux-x64 node", shell=True)33 # subprocess.run(f"export PATH=/home/user/app/node/bin:$PATH", shell=True)34 # subprocess.run(f"/home/user/app/node/ install -g npm", shell=True)35 # subprocess.run(f"apt-get install -f", shell=True)36 # subprocess.run(f"apt-get install -y fonts-nanum", shell=True)37 # subprocess.run(f"fc-cache -fv", shell=True)38 # subprocess.run(f"rm ~/.cache/matplotlib -rf", shell=True)39 40 