因为调换需要,进了另外一个维护组,需要用python解析excel csv,所以就下载了一下他们需要的python3.7
如何做呢,看步骤
1.去官网
2.找版本
3.下源码
4.解压出来进入文件夹
开始编译安装
cd Python-3.7.11/
./configure --enable-optimizations
sudo make
sudo make install
python3.7 -V
好了,返回 Python 3.7.11
版本有了
随手写个小代码 py_csv.py
import csv
headers = ['class','name','sex','height','year']
rows = [
[1,'xiaoming','male',168,23],
[1,'xiaohong','female',162,22],
[2,'xiaozhang','female',163,21],
[2,'xiaoli','male',158,21]
]
with open('test.csv','w') as f:
f_csv = csv.writer(f)
f_csv.writerow(headers)
f_csv.writerows(rows)
python3.7 py_csv.py 执行完毕
发现文件有了
打开一看 有了