# coding:utf8 from config import opt import os import torch as t import models from data.dataset import DogCat from torch.utils.data import DataLoader from torchnet import meter from utils import Visualizer from tqdm import tqdm1、问题描述:
书籍上的代码例子,执行环境依赖库安装。
pip install -r requirements.txt
发现这句指令有错,pip install git+https://github.com/pytorch/tnt.git@master
安装依赖包torchnet:tnt。遇到如下错误:
2、解决办法:PS D:PycharmProjectsclassic> pip install git+https://github.com/pytorch/tnt.git@master
Collecting git+https://github.com/pytorch/tnt.git@master
Cloning https://github.com/pytorch/tnt.git (to revision master) to c:usersadministratorappdatalocaltemppip-req-build-j0h97qgi
Running command git clone -q https://github.com/pytorch/tnt.git 'C:UsersAdministratorAppDataLocalTemppip-req-build-j0h97qgi'
ERROR: Error [WinError 2] 系统找不到指定的文件。 while executing command git clone -q https://github.com/pytorch/tnt.git 'C:UsersAdministratorAppDataLocalTemppip-req-build-j0h97qgi'
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
1)主要是没有安装git包,执行命令:
conda install git
2)完成安装git后,再次执行requirements中的指令,完成torchnet包的安装:
pip install git+https://github.com/pytorch/tnt.git@master



