Python 공공 데이터 분석 [PlaLab]

Python [PlaLab]

[5/11] Python 개발 환경 세팅

0. 오픈 튜트리얼 wiki 사용법

--> 다시 확인.

 

1. Python

 

-- Python 3.6.1 32bit 설치

-- windwos 환경 변수 확인  %PYTHON_HOME%;%PYTHON_HOME\scripts;

-- pip3 설치 확인

 

!! 원래는 linux 에서는 python -> easy_install -> pip 설치. easy_install deprecated.

 

 

2. pip 사용법

-- pip3 search oracle

-- pip3 search pandas

-- pip3 search pandas_datareader

-- pip3 install pandas

-- pip install wheel file

-- import pandas

 

D:\>pip list

DEPRECATION: The default format will switch to columns in the future. You can use --

f under the [list] section) to disable this warning.

pip (9.0.1)

setuptools (28.8.0)

 

D:\> pip3 list --format columns

Package    Version

---------- -------

pip        9.0.1

setuptools 28.8.0

 

D:\>pip3 search pandas |more

 

 

D:\>pip3 install pandas

Collecting pandas

  Downloading pandas-0.20.1-cp36-cp36m-win32.whl (7.5MB)

    100% |████████████████████████████████| 7.5MB 107kB/s

Collecting pytz>=2011k (from pandas)

  Using cached pytz-2017.2-py2.py3-none-any.whl

Collecting python-dateutil>=2 (from pandas)

  Using cached python_dateutil-2.6.0-py2.py3-none-any.whl

Collecting numpy>=1.7.0 (from pandas)

  Using cached numpy-1.12.1-cp36-none-win32.whl

Collecting six>=1.5 (from python-dateutil>=2->pandas)

  Using cached six-1.10.0-py2.py3-none-any.whl

Installing collected packages: pytz, six, python-dateutil, numpy, pandas

Successfully installed numpy-1.12.1 pandas-0.20.1 python-dateutil-2.6.0 pytz-2017.2 six-1.10.0

 

D:\>

D:\>pip list --format columns

Package         Version

--------------- -------

numpy           1.12.1

pandas          0.20.1

pip             9.0.1

python-dateutil 2.6.0

pytz            2017.2

setuptools      28.8.0

six             1.10.0

 

D:\>

 

4. MSSQL. 예제.

-- library 설치

D:\dev\workspace\Python>pip3 install pymssql

Collecting pymssql

-- Error

 

D:\dev\Python36-32\wheels>pip3 install pymssql-2.1.3-cp36-cp36m-win32.whl

Processing d:\dev\python36-32\wheels\pymssql-2.1.3-cp36-cp36m-win32.whl

Installing collected packages: pymssql

Successfully installed pymssql-2.1.3

 

D:\dev\Python36-32\wheels>

 

-- 예제 실행

D:\dev\workspace\Python>python dbConnMSSQL.py

Traceback (most recent call last):

  File "pymssql.pyx", line 635, in pymssql.connect (pymssql.c:10734)

  File "_mssql.pyx", line 1902, in _mssql.connect (_mssql.c:21821)

  File "_mssql.pyx", line 637, in _mssql.MSSQLConnection.__init__ (_mssql.c:6581)

  File "_mssql.pyx", line 1630, in _mssql.maybe_raise_MSSQLDatabaseException (_mssql.c:17524)

_mssql.MSSQLDatabaseException: (20009, b'DB-Lib error message 20009, severity 9:\nUnable to con

:53329)\nNet-Lib error during Unknown error (10060)\n')

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "dbConnMSSQL.py", line 3, in <module>

    conn = pymssql.connect(host='localhost:53329', user='rohys03', password='qwer12', database=

  File "pymssql.pyx", line 641, in pymssql.connect (pymssql.c:10824)

pymssql.OperationalError: (20009, b'DB-Lib error message 20009, severity 9:\nUnable to connect:

9)\nNet-Lib error during Unknown error (10060)\n')

 

D:\dev\workspace\Python>python dbConnMSSQL.py

Col1=26145, Col2=9609

Col1=26146, Col2=9553

Col1=26147, Col2=2493

Col1=26148, Col2=7318

Col1=26149, Col2=7883

Col1=26150, Col2=9835

Col1=26151, Col2=4965

Col1=26152, Col2=6612

Col1=26153, Col2=1364

Col1=26154, Col2=8686

Fetch End.

 

D:\dev\workspace\Python>

 

 

 

7. Atom 설치 패키지

1. script : atom run script

https://atom.io/packages/script

 

2. autocomplete-python : autocomplete statement

 

3. highlight

 

4. xml formatter

댓글

댓글 본문
버전 관리
virus
현재 버전
선택 버전
graphittie 자세히 보기