Hyeonseo's picture
Update presentation_assistant/env_set.py
4e7a6d1
import subprocess
import os
import sys
sys.path.append("/home/user/app")
def env_set():
# ํŒจํ‚ค์ง€๊ฐ€ ์ด๋ฏธ ์„ค์น˜๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธ
installed_packages = subprocess.check_output("pip list", shell=True).decode()
if "PyPDF2" not in installed_packages:
subprocess.run(f"pip install PyPDF2", shell=True)
if "python-pptx" not in installed_packages:
subprocess.run(f"pip install python-pptx", shell=True)
# pandoc ์‹คํ–‰ ๊ถŒํ•œ ์„ค์ •
if not os.access("./pandoc-2.14.2/bin/pandoc", os.X_OK):
subprocess.run(f"chmod +x ./pandoc-2.14.2/bin/pandoc", shell=True)
# ๋””๋ ‰ํ† ๋ฆฌ ๊ถŒํ•œ ์„ค์ •
if not os.access(".", os.W_OK):
subprocess.run(f"chmod -R 777 .", shell=True)
# subprocess.run(f"wget https://github.com/jgm/pandoc/releases/download/2.14.2/pandoc-2.14.2-linux-amd64.tar.gz", shell=True)
# subprocess.run(f"tar -xvf pandoc-2.14.2-linux-amd64.tar.gz", shell=True)
# subprocess.run(f"wget https://nodejs.org/dist/v17.0.1/node-v17.0.1-linux-x64.tar.xz", shell=True)
# subprocess.run(f"tar -xf node-v17.0.1-linux-x64.tar.xz", shell=True)
# subprocess.run(f"mv node-v17.0.1-linux-x64 node", shell=True)
# subprocess.run(f"export PATH=/home/user/app/node/bin:$PATH", shell=True)
# subprocess.run(f"/home/user/app/node/ install -g npm", shell=True)
# subprocess.run(f"apt-get install -f", shell=True)
# subprocess.run(f"apt-get install -y fonts-nanum", shell=True)
# subprocess.run(f"fc-cache -fv", shell=True)
# subprocess.run(f"rm ~/.cache/matplotlib -rf", shell=True)