Colab查看GPU型号
print("============查看GPU信息================")
# 查看GPU信息
!/opt/bin/nvidia-smi
# 或者使用如下命令也可以
# !nvidia-smi
print("==============查看pytorch版本==============")
# 查看pytorch版本
import torch
print(torch.__version__)
print("============查看虚拟机硬盘容量================")
# 查看虚拟机硬盘容量
!df -lh
print("============查看cpu配置================")
# 查看cpu配置
!cat /proc/cpuinfo | grep model\ name
print("=============查看内存容量===============")
# 查看内存容量
!cat /proc/meminfo | grep MemTotal
参考博客
这个是导入google drive云盘???
from google.colab import drive
drive.mount('/content/drive')
import os
os.chdir("/content/drive/My Drive/Colab Notebooks")
安装anaconda
!wget https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh
!bash Anaconda3-5.3.0-Linux-x86_64.sh -bfp /usr/local
import sys
sys.path.insert(0, "/usr/local/lib/python3.7/site-packages/")
!conda install -c bioconda -yq python=3.7 muscle
# 检查anaconda是否安装成功
!conda --version #在ipynb中执行终端命令时需要加上感叹号
创建虚拟环境
conda create --name d2l python=3.8 -y
激活虚拟环境
%%bash
source activate tfgpu
或者!source activate tfgpu
参考博客
Anaconda和python的版本对应关系
colab+vscode
报错:Cannot uninstall ‘wrapt’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
pip install -U --ignore-installed wrapt enum34 simplejson netaddr