python笔记
Python笔记
杂项
列表遍历
1 | # 整数步长 |
查看gpu情况
1 | # 在命令行里 |
绘图
matpltlib

matplotlib是一个最大的绘图库,包括了pyplot、pylaib等基础绘图库。
1 | import matplotlib.pyplot as plt |
- 标题
1 | plt.title("title") # 括号当中输入标题的名称 |
- Figure对象
1 | plt.figure(figsize=(6, 3)) |
- 坐标轴
1 | plt.xlim(0,6) #x轴坐标轴 |
- 注释箭头
1 | plt.annotate(text='标记点',xy=(3,np.sin(3)),xytext=(4,-0.5),weight='bold',color='b',arrowprops=dict(arrowstyle='-|>',color='k')) |
git
基本步骤
-
添加公钥:everything搜索
id_rsa.pub,复制其中内容到github/gitee -
克隆仓库到本地
1
git clone https://gitee.com/momaoto/fourth-assignment.git
-
进入文件夹初始化仓库
1
git init
-
关联远程仓库
1
2
3git remote add origin https://gitee.com/momaoto/fourth-assignment.git
git remote rm origin
git remote -vorigin为后面链接所指远程库的别名,方便操作
-
拉取远程分支与本地仓库合并
1
git pull origin master:main
-
代码添加进本地暂存区
1
2git add .
git add test.txt -
确认提交记录到本地仓库
1 | git commit . |
- 安装子模块
1 | # 根目录下 |
命令大全
1 | git remote:不带任何参数直接运行 git remote,将会列出当前仓库中已经配置的远程仓库的简写名称列表。 |
设置私人令牌
1 | git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git |
暂存区
1 | git ls-files |
查看代码行数
1 | git ls-files | xargs wc -l |
1 | Username for 'https://gitee.com': momaoto |
git原理:
conda
创建新环境
1 | conda create --name mesh2gs python=3.10 |
激活环境
1 | conda activate mesh2gs |
退出当前环境
1 | conda deactivate |
查看已有环境
1 | conda env list |
删除不需要的环境
1 | conda env remove --name myenv |
清理缓存
1 | pip cache purge |