ubuntu、conda、pip、docker、jupyter命令

写在前面:
conda 会覆盖pip安装的包,pip 不会覆盖conda的包。
尽量避免混用,如果必须要混用,先用conda再用pip。

conda

conda config --set show_channel_urls yes
conda info --env
conda info
conda --version
conda install package_name1 package_name2 package_name3
conda list
conda env list

conda env export > environment.yaml
conda env create -f environment.yaml


conda activate pytorch
conda remove -n your_env_name --all
conda create --name tensorflow python=3.8
conda create -name your_env_name python=version_no anaconda ##(如果末尾不添加anaconda命令,则该虚拟环境只有python,没有其他包)
conda search tensorflow-gpu
conda list



conda clean -i 


conda search cudatoolkit

conda install cudatoolkit=8.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/

conda install cudnn=7.0.5 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/

conda install --yes --file requirements.txt

conda 配置镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes


docker

docker run --gpus all --name="xiao-pycharm" -it -p 1888:8888 -p 1006:6006 -v /sda1/xiao/xiehongyan:/home python3.8_torch1.8.2:1.0 /bin/bash
--ipc=host
--shm-size="15g"
--ulimit memlock=-1
 --ulimit stack=67108864
memlock=-1表示无限制内存锁定,stack=67108864表示栈的最大大小为64MB

docker run --gpus all --name="xiao_ubuntu20.04" -it -p 2223:22 -p 6007:2007 -p 6008:2008 -p 2006:6006 -v /sda1/xiao/xiao_ubuntu20.04:/home /sda1/xiao/Datasets:/home 3918f26174ea  /bin/bash

docker run --gpus all --name="xiao-ultralytics" -it -p 11741:22 -p 1889:8888 -p 2006:6006 -p 8080:80 -v /mnt/data/xiao/pycharm-spqce/ultralytics230614:/home --ipc=host --ulimit memlock=-1 ultralytics/ultralytics:latest  /bin/bash

docker attach test

sudo service docker start
sudo service docker stop
sudo service docker restart
systemctl restart docker

pip

pip freeze > requirements.txt
pip install opencv-python     (cv2)
pip install tensorflow==2.6.0

pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
pip config set install.trusted-host mirrors.aliyun.com
 阿里云 http://mirrors.aliyun.com/pypi/simple/
 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
 豆瓣(douban) http://pypi.douban.com/simple/
 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
 
pip临时换源:
pip install xxx -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

tensorboard

使用绝对路径: tensorboard --logdir=D:\Python\pytorchLearn\learn\logs
!tensorboard --logdir=train-logs
!tensorboard --logdir /home/train-logs --port 6006 --bind_all

ubuntu

uname -a
pwd
bash Anaconda3-2022.05-Linux-x86_64.sh
htop
free -m 
nvidia-smi
sudo chown -R apr:user /var/lib/docker

检查pytorch与cuda的安装

import torch
import sys
print(sys.version)
print(torch.__version__)
print(torch.cuda.is_available())

检查tensorflow与cuda的安装import sys

import sys
print(sys.version)
import tensorflow as tf
tf.autograph.set_verbosity(0)
physical_devices = tf.config.experimental.list_physical_devices('GPU')
print(physical_devices)
config = tf.config.experimental.set_memory_growth(physical_devices[0], True)
import tensorflow as tf
print(tf.test.is_gpu_available())
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

jupyter

jupyter notebook --port 1011   #指定1011端口启动
nohup python -u main.py > test.out 2>&1 &
tail -f test.out
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值