Programming/Python
-
[Python] 파이썬 기초 1 (리스트, 튜플, 사전자료형, 집합자료형)Programming/Python 2022. 5. 17. 16:55
1. 리스트 b = ["a", "b", 1, 2] print(b) print('\n') 2. 튜플 #튜플------------------------------------------ a = (1,2,3,4) print(a) print('\n') 3. 사전자료형 : dic() #사전 자료형-------------------------------------- data = dict() data['사과'] = 'Apple' data['바나나'] = 'banana' data['코코넛'] = 'Coconut' print(data) print('\n') #초기화 방법2 b = { '홍길동' : 97, '이순신' : 98 } print(b) print('\n') if '사과' in data: print('사과 존재!!'..
-
[Python] Visual Studio Code 에러 : 이 시스템에서 스크립트를 사용할 수 없으므로Programming/Python 2021. 11. 14. 11:38
Visual Studio Code 에 Python을 설치해서 사용하려던 중에 "이 시스템에서 스크립트를 실행할 수 없으므로 ~~ .ps1파일을 로드할 수 없습니다." 라는 에러메시지가 나왔습니다. 스크립트 실행 권한 때문에 발생한 오류입니다. 1. Windows PowerShell 을 관리자로 실행합니다. 2. 현재 적용되어 있는 권한 상태를 확인합니다. " get-ExecutionPolicy "
-
[Python] Python 개발 환경 (Visual Studio 2017)Programming/Python 2021. 11. 8. 21:20
Visual Studio 2017 에서 python 개발 환경을 세팅 방법에 대해 포스팅하겠습니다. 1. Python 프로젝트를 생성해 주세요. 2. 가상 환경은 왜 만들어야 할까요? python은 pip패키지로 설치하게 됩니다. 평소에는 이 방식이 문제가 없지만 프로젝트를 여러 개 개발할 때에는 패키지 버전 문제가 발생한다고 합니다. 예를 들어 프로젝트 A에서는 패키지X 1.5를 사용해야 하고, 프로젝트 B에서는 패키지X 2.0을 사용해야 하는 경우가 생깁니다. 이 패키지X 1.5와 2.0은 호환이 되지 않는다면 개발하기가 상당히 불편해집니다. 이런 문제를 해결하기 위해 python에서 "가상 환경"을 제공합니다. 더 자세한 설명은 아래 링크를 참고해주세요. https://dojang.io/mod/pa..
-
[Python] Python 가상 환경 만들기 (Visual Studio Code 적용)Programming/Python 2021. 11. 8. 18:54
Visual Studio Code 에서 Python을 사용하기 위해 필요한 가상 환경을 만들어 보겠습니다. 1. 작업을 위한 새로운 폴더를 생성합니다. 2. 명령프롬프트(cmd) 에서 새로운 폴더에서 python venv 환경을 설치합니다. 명령어 : " python -m venv [저장할 가상 환경 이름] " visual studio code의 Terminal 창에서 해도 됩니다. 3. 가상 환경 폴더 생성 확인 명령프롬프트에서 "dir"로 확인해도 되고, 생성한 경로에 가면 "myenv" 가 생성됨을 확인 할 수 있습니다. 4. 가상 환경 활성 "[가상 환경 저장 경로]\scripts " 에 있는 activate.bat 을 실행하면 됩니다. 정상적으로 실행되면 가상 환경 이름(myenv) 이 앞에 있..
-
[Python] Python 설치 (Visual Studio Code)Programming/Python 2021. 11. 8. 15:43
visual studio code에 python을 설치해 보겠습니다. 1. 먼저 visual studio code에 python을 검색 후 install 버튼을 클릭합니다. python을 설치하라는 메시지가 뜬다면 아래 링크를 참고해서 python을 설치해주세요~ https://code-space.tistory.com/entry/Python-Python-%EC%84%A4%EC%B9%98-Visual-Studio-Code [Python] python설치 1. python 공식 홈페이지에서 최신 버전의 python 설치 패키지를 다운로드합니다. Download Python | Python.org Download Python The official home of the Python Programming Lan..
-
[Python] Python 설치 (Visual Studio 2017)Programming/Python 2021. 11. 8. 13:49
저는 Visual Studio 2017 를 잘 사용하고 있어서 여기에 Python을 세팅해보도록 하겠습니다. python tool들이 많이 있긴 하지만 Visual Studio 2017에서 제공도 하고 괜찮다는 평이 있어서 사용해 보려고 합니다. 1. Visual Studio 2017 을 실행한 후 "도구 > 도구 및 기능 가져오기" 를 클릭합니다. Python개발을 클릭하면 "설치 세부 정보" 항목이 나타납니다. 여기서 python 설치도 한번에 할 수 있습니다. python설치가 되지 않았다면 함께 선택해 주세요! python 버전이 3.6.6 이라 저는 최신 버전을 설치하고 싶어 여기서 설치하지 않고 공식 홈페이지에서 미리 다운로드 받았습니다. /* 공식홈페이지를 통해 python을 설치하는 방법은..
-
[Python] python설치Programming/Python 2021. 11. 8. 12:19
1. python 공식 홈페이지에서 최신 버전의 python 설치 패키지를 다운로드합니다. Download Python | Python.org Download Python The official home of the Python Programming Language www.python.org OS 환경에 맞는 패키지를 다운로드합니다. 2. Python installer를 실행합니다. "Add Python 3.10 to Path" 항목을 선택하면 환경 변수에 python path 를 설정하게 됩니다. 선택하지 않아도 되지만 python.exe를 바로 사용하지 않고 외부 툴을 이용해서 개발하는 경우 외부에서 python을 사용하기 위해서는 path설정이 되어있어야 합니다. 여기서 설정하지 않아도 '제어판>시..