1,阅读Pytorch C++官网文档,在虚拟机上安装Ubuntu16.04的Linux操作系统搭建环境,并使用makefile进行编译,代码简洁易读。
sudo apt-get update
sudo apt-get install vim make cmake gcc g++ libnss3 tree git openssh-server openssh-client
2,下载pytorch c++ cpu 库文件,并解压,注意此目录路径,cmake编译需要
unzip libtorch-shared-with-deps-latest.zip
pwd
3,安装vscode,下载地址:linux vscode,解压并启动
sudo dpkg -i code_1.32.1-1552006243_amd64.deb
code
4,创建一个工程,目录结构:
ai@ai-virtual-machine:~/pro/tb/day01_test_env_cpu$ tree
.
├── bin