目錄
- 前言
- 一、Conda
- 二、Docker
- 三、Linux操作
- 總結
前言
實驗程序中,時常會用到一些指令,包括conda,docker,以及一些linux的指令,發個帖子來記錄一下,并日后持續更新,
一、Conda
國內鏡像源匯總:
阿里云: https://mirrors.aliyun.com/pypi/simple/
中國科技大學: https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣: http://pypi.douban.com/simple/
清華大學: https://pypi.tuna.tsinghua.edu.cn/simple/
中國科學技術大學: http://pypi.mirrors.ustc.edu.cn/simple/
1.pip 安裝與卸載
pip install 包名 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip uninstall 包名
另外,如果pip安裝不了的話,可以去這里或者這里找一找看有沒有需要的包,然后將它的wheel給下載到本地,這里cmd進入到下載路徑,在下載路徑下直接pip install 檔案名(手動下載的wheel)即可,
2.查看conda中已有的虛擬環境
conda env list
3.創建python虛擬環境,其中your_env_name就是你自己的虛擬環境的名字,X.X就是虛擬環境的python版本
conda create -n your_env_name python=X.X
4.激活虛擬環境
Windows:activate your_env_name
Linux:source activate your_env_name
二、Docker
docker exec -it xxx /bin/bash //進入名為xxx的容器
exit //退出容器
docker pull xxx //默認從docker hub中拉取鏡像,tag默認使用:latest
docker commit -a="your name" -m="對image的說明" container-name image-name //container-name容器名 ,
//image-name鏡像名 將一個容器變成一個鏡像
docker images //查看本地已有的images
docker ps //使用命令獲取容器的ID
docker start <the-container-id> //命令啟動容器
docker stop <the-container-id> //命令停止容器
docker rm -f <the-container-id> //停止和洗掉容器
docker rename old-container(舊容器名) new-container(新容器名)
docker logs <the-container-id> //查看docker容器日志
三、Linux操作
1.解壓
tar -xvf file.tar //解壓 tar包
tar -xzvf file.tar.gz //解壓tar.gz
unrar x test.rar //解壓 rar包
gzip -d FileName.gz //解壓.gz 壓縮包
bzip2 -d FileName.bz2 //解壓.bz2 壓縮包
2.壓縮
gzip FileName //壓縮gz格式
tar zcvf FileName.tar.gz DirName //壓縮tar格式
zip FileName.zip DirName //壓縮zip格式
3.Nvidia相關
nvidia-smi //查看顯卡使用率
watch -n 1 nvidia-smi //每隔1秒重繪一次,查看顯卡使用率
總結
會持續更新
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/344414.html
標籤:其他
