pip, virtualenv, vagrant - python korea 2014년 6월 세미나
DESCRIPTION
TRANSCRIPT
![Page 1: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/1.jpg)
pipvirtualenvvagrant
![Page 2: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/2.jpg)
lexifdev반도에 흔한 평범한 개발자
![Page 3: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/3.jpg)
모든 것은 이 한마디로 부터 ..
![Page 4: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/4.jpg)
“ 어 ? 여기에선 잘 돌았는데 ..”
![Page 5: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/5.jpg)
왜 이러는 걸까요 ?“ 무언가 다르다… 무언가 ..”
module 이 안깔렸나 ? 버전이 다른게 깔렸나 ? 환경변수가 다른가 ?
![Page 6: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/6.jpg)
이런일 없는 개발환경이 되려면 ..
- 재구성 가능한 (Reproducible)
- 격리된 (Isolated)
![Page 7: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/7.jpg)
pipvirtualenvvagrant
![Page 8: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/8.jpg)
pip= Python 패키지 관리 시스템
= Search Install Uninstall
![Page 9: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/9.jpg)
install pip$ wget https://bootstrap.pypa.io/get-pip.py$ sudo python get-pip.py
![Page 10: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/10.jpg)
search in pip$ pip search werkzeug
RESTpy - Werkzeug extensions for building…Werkzeug - The Swiss Army knife of Python web…kiss.py - MVC web framework in Python…Flask - A microframework based on Werkzeug………
![Page 11: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/11.jpg)
install in pip$ pip install django
Downloading/unpacking django Downloading Django-1.6.5-py2.py3-none-any.whl (6.7MB): 6.7MB downloadedInstalling collected packages: djangoSuccessfully installed djangoCleaning up...
![Page 12: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/12.jpg)
check in pip$ pip freezeDjango==1.6.5wsgiref==0.1.2
![Page 13: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/13.jpg)
uninstall in pip$ pip uninstall django
Uninstalling Django: … … Proceed (y/n)? y Successfully uninstalled Django
![Page 14: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/14.jpg)
install in pip (specific version)
$ pip install django==1.5Downloading/unpacking django==1.5 Downloading Django-1.5.tar.gz (8.0MB): 8.0MB downloadedRunning setup.pySuccessfully installed djangoCleaning up...
![Page 15: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/15.jpg)
check again in pip$ pip freezeDjango==1.5wsgiref==0.1.2
![Page 16: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/16.jpg)
export in pip$ pip freeze > requirements.txt$ cat requirements.txt
Django==1.5wsgiref==0.1.2
![Page 17: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/17.jpg)
import in pip$ pip install -r requirements.txt
Downloading/unpacking django==1.5 Downloading Django-1.5.tar.gz (8.0MB): 8.0MB downloadedRunning setup.pySuccessfully installed djangoCleaning up...
![Page 18: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/18.jpg)
pip in PyCharmPyCharm-> Preference (⌘ + ,)-> Project Interpreter
Install
Uninstall
Upgrade
![Page 19: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/19.jpg)
pip in PyCharm Editor
alt + ↵
![Page 20: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/20.jpg)
pip 끝
![Page 21: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/21.jpg)
격리된 환경 (Isolated)프로젝트 두개를 하는데 ..하나는 django 1.6 기반이고하나는 django 1.5 기반이면 ..뭘 깔아야되지…
![Page 22: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/22.jpg)
virtualenv=Python Virtual Environment
= 독립된 파이썬 환경을 구축할 수 있음
![Page 23: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/23.jpg)
install virtualenv$ sudo pip install virtualenv
![Page 24: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/24.jpg)
create virtualenv$ virtualenv envNew python executable in env/bin/pythonInstalling setuptools, pip...done.$ lsenv
![Page 25: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/25.jpg)
internal virtualenv$ ls envbin include lib$ ls env/binactivate pip python … …$ ls env/lib/python2.7abc.py re.py os.py … … site.py site-package
![Page 26: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/26.jpg)
activate virtualenv$ source env/bin/activate$ which python./env/bin/python$ which pip./env/bin/pip
![Page 27: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/27.jpg)
install package on virtualenv
$ pip install django
Downloading/unpacking django Downloading Django-1.6.5-py2.py3-none-any.whl (6.7MB): 6.7MB downloadedInstalling collected packages: djangoSuccessfully installed djangoCleaning up...
![Page 28: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/28.jpg)
deactivate virtualenv
$ deactivate$ which python/usr/bin/python$ which pip/usr/local/bin/pip
![Page 29: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/29.jpg)
두개의 virtualenv 를 만들고각각 다른 버전 django 설치하기
$ virtualenv env1$ activate env1/bin/activate$ pip install django$ django-admin.py version1.6.5$ deactivate$ virtualenv env2$ activate env2/bin/activate$ pip install django==1.5$ django-admin.py version1.5
![Page 30: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/30.jpg)
virtualenv in PyCharm
PyCharm-> Preference (⌘ + ,)-> Project Interpreter
기존 Virtualenv 를 선택하거나새 Virtualenv 를 만들 수 있음
![Page 31: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/31.jpg)
virtualenv 끝
![Page 32: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/32.jpg)
package 수준이 아니라 ..DBMS 버전이 다르다면 ..php 버전이 다르다면 ..
![Page 33: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/33.jpg)
VM + vagrantvagrant = 개발환경 구축용 가상머신 관리 도우미
![Page 34: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/34.jpg)
install vagrant$ brew cask install vagrant
# cask 없으면 먼저 cask 설치$ brew tap caskroom/cask$ brew install brew-cask
mac 용
![Page 35: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/35.jpg)
initial vagrant$ vagrant init$ lsVagrantfile
![Page 36: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/36.jpg)
Vagrantfile 주요설정config.vm.box = “hashicorp/precise64”# https://vagrantcloud.com/discover/config.vm.network forwarded_port", guest: 80, host: 8080config.vm.synced_folder "./src", "/web"
![Page 37: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/37.jpg)
start vagrant$ vagrant up==> default: Booting VM…==> default: Waiting for machine to boot.==> default: Machine booted and ready!
![Page 38: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/38.jpg)
vagrant 안으로$ vagrant sshWelcome to Ubuntu 12.04.4 LTS
vagrant@precise64:~$
![Page 39: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/39.jpg)
vagrant in PyCharm$ Tools-> Vagrant
![Page 40: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/40.jpg)
vagrant in PyCharm1. vagrant 로 설정
2. Vagrantfile 있는디렉토리로 설정
3. vagrant 안에 있는virtualenv 설정 가능
![Page 41: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/41.jpg)
export vagrant$ vagrant package$ ls… package.box …
![Page 42: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/42.jpg)
import vagrant$ vagrant add box mybox package.box$ vagrant init mybox
![Page 43: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/43.jpg)
vagrant 끝
![Page 44: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/44.jpg)
One More Thing
![Page 45: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/45.jpg)
Remote Development in PyCharm
![Page 46: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/46.jpg)
Setup ‘Remote Interpreter’
![Page 47: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/47.jpg)
Setup ‘Deployment’Tools-> Deployment-> Configuration
![Page 48: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/48.jpg)
mac 용
![Page 49: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/49.jpg)
SyncTools-> Deployment-> Sync with …
![Page 50: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/50.jpg)
mac 용
![Page 51: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/51.jpg)
Run! (control + r)
![Page 52: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/52.jpg)
Auto Upload 를 쓸 수도 있어요 ..
이 옵션 켜면파일 저장하는 순간
바로 파일을 올림
![Page 53: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/53.jpg)
전부 끝
![Page 55: pip, virtualenv, vagrant - Python Korea 2014년 6월 세미나](https://reader033.vdocuments.mx/reader033/viewer/2022052504/548d6976b47959ef3b8b47ef/html5/thumbnails/55.jpg)
Additional Keywordsautoenvvirtualenvwrapperdocker