Commonly used commands (conda, pip, docker, linux)
(for personal use)
conda
conda list # 查看当前环境里已安装的包:
conda active env-name # 激活环境
conda update conda #检查更新当前conda
conda create -n your_env_name python=x.x #Python创建虚拟环境
conda remove -n your_env_name --all 删除虚拟环境
conda remove --name $your_env_name $package_name #删除环境钟的某个包
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ # 添加Anaconda的TUNA镜像
conda config --set show_channel_urls yes # 设置搜索时显示通道地址
conda config --remove-key channels #恢复默认镜像
pip
pip list # 看pip install 的包
docker
# 报错误:docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
# 解决方式: first start and enable docker in systemctl
systemctl start docker
systemctl enable docker
sudo docker info #看Debug Mode、Plugins、Server等
docker version # 看docker 的版本信息
docker images #查看本地所有的镜像
sudo docker images #查看本地所有的镜像 非root
docker images –q # 查看所用镜像的id
docker build -t nginx:v3 . # 在 Dockerfile 文件的存放目录下,执行构建build nginx:v3(镜像名称:镜像标签);. 代表本次执行的上下文路径
Linux
ll # 看文件 可读 可写等
python
print(包名称.__file__) # 查找某个包所在具体路径
print(方法名称.__code__) #查找某个方法所在文件路径
pydoc modules # 命令行下运行;打python进入命令行 ubuntu 下查看安装的python模块
help("modules") # 交互式解释器中输入 ubuntu 下查看安装的python模块
#常用的库
from tqdm import tqdm # 快速,可扩展的Python进度条,可以在 Python 长循环中添加一个进度提示信息