티스토리 뷰
$ brew update
$ brew upgrade
# python 3.10 brew 설치
$ brew search python3
$ brew install python@3.10
# pyenv / pyenv-virtualenv 설치하기
$ brew install pyenv
$ brew install pyenv-virtualenv
# zsh 환경 설정 : pyenv / pyenv-virtualenv
$ nano ~/.zshrc
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/shims:${PATH}"
export PYENV_ROOT
export PATH
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
$ source ~/.zshrc
# pyenv 3.10.0 설치 및 전역변수 설정
$ pyenv install --list
$ pyenv install 3.10.0
$ pyenv global 3.10.0
$ pyenv versions
# pyenv 3.10.0 가상환경 사용
$ pyenv virtualenv 3.10.0 py_test3.10.0
$ pyenv activate py_test3.10.0
(py_test3.10.0)$ python3 -V
- 가상환경 종료
(py_test3.10.0)$ pyenv deactivate
- 가상환경 보기
$ pyenv virtualenvs
- 가상환경 제거
$ pyenv uninstall py_test3.10.0
# persona-erp 가상환경 설정 및 django 설치
$ pyenv virtualenv 3.10.0 persona-erp
--> ~/.pyenv/versions persona-erpy 심볼릭링크 생성
--> 실제 경로 : ~/.pyenv/versions/envs/persona-erp
-pip 경로 및 pyenv 경로/활성화 설정
# zshrc aliace : pip 바로가기
$ nano ~/.zshrc
alias pip='python3 -m pip'
aliace 설정 후 python3 -m 커멘드 생략
(persona-erp)$ pip install --upgrade pip
# zshrc aliace : pyenv 가상환경 바로가기
$ touch persona-erp.sh
$ nano persona-erp.sh
cd ~/.pyenv/versions/3.10.0/envs/persona-erp
pyenv activate persona-erp
$ source persona-erp.sh
# django 설치 : 가상환경 바로가기 path에 설정된 위치에서 설치
(persona-erp)$ pip install --upgrade pip
(persona-erp)$ pip install django
(persona-erp)$ mkdir django-erp
(persona-erp)$ cd django-erp
(persona-erp)$ django-admin.py startproject config .
- version 확인
(persona-erp)$ pip list
Package Version
---------- -------
asgiref 3.4.1
Django 3.2.8
pip 21.3.1
pytz 2021.3
setuptools 57.4.0
sqlparse 0.4.2
(persona-erp)$ python3
Python 3.10.0 (default, Oct 25 2021, 12:08:59) [Clang 12.0.0 (clang-1200.0.26.2)] on darwin
>> import django
>> print(django.__version__)
3.2.8
# Sublime Text 3 REPL 설정
- key bindings
Preferences > Key Bindings
mac
{ "keys":["command+shift+b"], "command":"run_existing_window_command", "args":{"id": "repl_python_run", "file": "config/Python/Main.sublime-menu"} }
- SublimeREPL : Python - Run current file 경로 수정 :
파일경로 : /Users/[YourID]/Library/Application Support/Sublime Text3/Packages/SublimeREPL/config/Python/Main.sublime-menu
{"command": "repl_open",
"caption": "Python - RUN current file",
"id": "repl_python_run",
"mnemonic": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["/Users/[YourID]/.pyenv/shims/python3", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
pyenv 외 python3.10 버전 안될 시 참고 : https://jinozblog.tistory.com/65
# django 실행
(persona-erp)$ ./manage.py runserver
browser 실행 : http://localhost:8000/
'python > django_ERP2' 카테고리의 다른 글
(macOS)[python] django-erp : templates 분리 (1) mysite (0) | 2021.11.07 |
---|---|
(macOS)[python] django-erp : bootstrap 적용 (0) | 2021.11.05 |
(macOS)[python] django-erp : login, logout, signup, signup_waiting (0) | 2021.11.05 |
(macOS)[python] django-erp : app 생성 (0) | 2021.11.04 |
(macOS)[python] django-erp : Django 초기설정 (0) | 2021.11.01 |
- Total
- Today
- Yesterday
- SSH
- github
- vscode
- git
- 라즈베리파이
- 코로나19
- Pandas
- Regression
- CSV
- DAQ
- analysis
- server
- Templates
- 확진
- Model
- 코로나
- template
- COVID-19
- sublime text
- raspberrypi
- pyserial
- MacOS
- 자가격리
- ERP
- Django
- arduino
- r
- Python
- DS18B20
- Raspberry Pi
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |