| ์ํฉ | ๋ช ๋ น์ด |
|---|---|
| ํ๊ฒฝ ๋ถ๋ฌ์ค๊ธฐ | conda env create -f conda.yaml |
| ํ๊ฒฝ ๋ด๋ณด๋ด๊ธฐ | conda env export > conda.yaml |
| ํ๊ฒฝ ์คํํ๊ธฐ | conda activate my-refrigerator |
์ฐธ๊ณ ์๋ฃ
๋ค์๊ณผ ๊ฐ์ ๊ตฌ์กฐ์ ํ์ผ์ ๋๋ค.
path: "/home/ubuntu/server"
banned_keyword_list: [ '๊ณ ๊ฐ', '๊ฒฐ์ ', '์นด๋', '์น์ธ', '๊ฐ๋งน์ ', '์ ํ', '๋ฒํธ', '์ฌ์
', 'ํ ๋ถ', '๊ฐ์' ]
analysis_keyword_list: [ '๋ฉ๋ด', '๋จ๊ฐ', '์๋', '๊ธ์ก' ]
api_key: 'API KEY'
DJANGO_CONFIG:
SECRET_KEY: 'DJANGO SCRET KEY'
ALLOWED_HOST: [ 'NGINX HOST NAME', '127.0.0.1' ]
ALLOWED_CORS_ORIGIN: [ 'http://example.com', 'https://example.com' ]
RDS_CONFIG:
ENGINE: 'RDS ENGINE'
HOST: 'RDS ADDRESS'
PORT: 77777
USER: 'RDS HOST'
PASSWORD: 'RDS PWD'
DATABASE_NAME: 'RDS_NAME'
JWT_CONFIG:
SECRET_KEY: 'JWT SECRET'
ALGORITHM: 'HS256'# [STEP 1] ๊ฐ์ํ๊ฒฝ ์ค์
apt update -y
apt install python3-venv
python3 -m venv venv
# [STEP 2] ๊ฐ์ํ๊ฒฝ ์ง์
sourc venv/bin/activate
# [STEP 3] APT ๋ชจ๋ ์ค์น
apt install libgl1-mesa-glx
apt install tesseract-ocr
apt install tesseract-ocr-eng
apt install tesseract-ocr-kor
apt install libmysqlclient-dev
# [STEP 4] PIP ๋ชจ๋ ์ค์น
pip install opencv-python
pip install matplotlib
pip install pytesseract
pip install imutils
pip install scipy
pip install python-decouple
pip install django-cors-headers
pip install pydantic
pip install mysqlclient
pip install PyMySQL
pip install PyJWT
pip install PyYamlconda create -n my-refrigerator -y
conda activate my-refrigerator
[after]
pip install opencv-python
pip install matplotlib
conda install -c conda-forge tesseract
conda install tesseract-ocr
conda install libtesseract-dev
pip install pytesseract
pip install imutils
pip install scipy
pip install orig [NOne]
pip install python-decouple
pip install django-cors-headers
pip install djangorestframework [Remove!]
pip install pydantic
pip install psycopg2 [Failure]
pip install psycopg2-binary [Success, instead of psyconpg2]
apt install libmysqlclient-dev [Dependency for mysqlclient]
pip install mysqlclient
pip install PyMySQL
pip install PyJWT# apt๋ฅผ ์ต์ ๋ฒ์ ์ผ๋ก ์
๋ฐ์ดํธ
apt update
# pip์ ์ค์น
# ์คํ ํ, python -V๋ก ํ์ธํ๋ฉด Python 2.7.17์ด ๋ณด์
apt install python
apt install python-pip
apt install python3-pip
# python3.8์ค์น
# python3์ AWS์์ ์ฌ์ฉํ๊ณ ์์ผ๋ฏ๋ก ๊ฑด๋๋ฆฌ์ง ์์ ๊ฒ!!
# ์ค์น ํ, python3.8 -V๋ก ํ์ธํ๋ฉด Python 3.8.0์ด ๋ณด์
# ์ค์น ํ, python -V๋ก ํ์ธํ๋ฉด Python 3.7.0์ด ๋ณด์
apt install python3.8
# ์๋ ๋ช
๋ น์ด๋ก ์ฌ๋ณผ๋ฆญ ๋งํฌ ๊ฒฝ๋ก ํ์ธ
ls -al /usr/bin/python
# ํด๋น ๊ฒฝ๋ก๋ฅผ ๋ณ๊ฒฝํ๊ธฐ ์ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น
apt install update-alternatives
# ์ฌ๋ณผ๋ฆญ ๋งํฌ ๋ณ๊ฒฝ์ด ๊ฐ๋ฅํ ๋์ฒด ํญ๋ชฉ์ /usr/bin/python3.8์ ์ถ๊ฐ
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2
# ์ฌ๋ณผ๋ฆญ ๋งํฌ ํญ๋ชฉ์ /usr/bin/python3.8์ผ๋ก ๋ณ๊ฒฝ
# ๋ณ๊ฒฝ ํ, python -V๋ก ํ์ธํ๋ฉด Python 3.8.0์ด ๋ณด์
update-alternatives --config python
# ์๋ ๋ช
๋ น์ด๋ก ์ฌ๋ณผ๋ฆญ ๋งํฌ ๊ฒฝ๋ก ํ์ธ
## lrwxrwxrwx 1 root root 24 Feb 2 06:45 /usr/bin/python -> /etc/alternatives/python
ls -al /usr/bin/python
# Python 3.8.0์ ๊ธฐ์ค์ผ๋ก pip์ ์
๋ฐ์ดํธ
python -m pip install --upgrade pip
# PIP์ผ๋ก OpenCV ์ค์น๋ฅผ ์ํ ์ข
์์ฑ ๋ชจ๋ ์ค์น
apt install libgl1-mesa-glx
# https://tesseract-ocr.github.io/tessdoc/Installation.html
sudo apt install tesseract-ocr -y
sudo apt install libtesseract-dev -y
sudo pip install pytesseract
sudo apt install tesseract-ocr-script-kor
# https://docs.opencv.org/3.4/d2/de6/tutorial_py_setup_in_ubuntu.html
sudo apt install python3-opencv -y
cd <ํ๋ก์ ํธ ๊ฒฝ๋ก>
cp ./assets/tesseract/kor.traineddata /usr/share/tesseract-ocr/4.00/tessdata/kor.traineddata