# 更新环境安装依赖
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake unzip pkg-config
sudo apt-get install libjpeg-dev libtiff-dev libpng-dev
sudo apt-get install libgtk-3-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python3.6-dev
# 安装pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
sudo pip install virtualenv virtualenvwrapper
sudo rm -rf ~/get-pip.py ~/.cache/pip
# python3设置为默认python
sudo ln -s /usr/bin/python3.6 /usr/bin/python
# 安装其他依赖项
pip install numpy
pip install scipy matplotlib
pip install scikit-learn
pip install scikit-image
pip install mahotas imutils Pillow json_minify
pip install opencv-python
# 查看opencv是否成功
>>> import cv2
>>> cv2.__version__
'4.5.3'
# 安装torch
pip install torch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
# 测试torch是否成功
>>> import torch
>>> torch.__version__
'1.7.0'
>>> torch.cuda.is_available()
True
|