import pyodbc
import numpy as np
import matplotlib.pyplot as plt
db = pyodbc.connect('DSN=Tibero6;UID=tibero;PWD=tmax')
cursor = db.cursor()
cursor.execute("select trunc(count(*)) from emp")
for row in cursor:
totalemps=int(row[0])
print(totalemps)
t=np.arange(totalemps)
cursor.execute("select ename,sal from emp")
names=[]
salaries=[]
for row in cursor:
names.append(row[0])
salaries.append(row[1])
bar_width=0.5
plt.bar(t,salaries,bar_width,label="Salary")
plt.title("Employee Details")
plt.xlabel("Employee")
plt.ylabel("Salary")
plt.xticks(t,names)
plt.grid(True)
plt.legend()
xs=[x for x in range(1,totalemps)]
for x,y in zip(xs,salaries):
plt.annotate(salaries[x],(x-bar_width/2,y))
plt.show()
pip list 명령을 통해 설치된 버전 확인 (pip 를 통해 파이썬에서 필요로 하는 팩키지를 설치할수 있습니다.)
(py27) [testuser1@centos7:/home/testuser1/venv]$ python -V Python 2.7.5 (py27) [testuser1@centos7:/home/testuser1/venv]$ pip --version pip 20.3.4 from /home/testuser1/venv/py27/lib/python2.7/site-packages/pip (python 2.7) (py27) [testuser1@centos7:/home/testuser1/venv]$ pip list DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. Package Version ---------- ------- pip 20.3.4 setuptools 44.1.1 wheel 0.37.1
#bin 경로 이동
cd /usr/bin
#링크 생성
ln -s /usr/src/Python-3.7.1/python python3
#profile alias 설정
vi /etc/profile
alias python="python3"
#profile 적용
. /etc/profile