有两个pip install与重新安装软件包相关的选项,它们是--ignore-installed和--force-reinstall.
这两个选项在官方文档中描述如下
--force-reinstall
Reinstall all packages even if they are already up-to-date.
-I, --ignore-installed
Ignore the installed packages (reinstalling instead).
Run Code Online (Sandbox Code Playgroud)
似乎他们都忽略了某些东西并进行了重新安装,但我无法区分它们(如果我实际执行它们,我会看到一些区别......但我无法解释).如果我搜索"力量重新安装PIP封装",结果列出了两个--ignore-installed和--force-reinstall,这让我困惑了很久.
我编写了一个 cnn 模块来使用 pytorch 进行数字识别,然后尝试使用 GPU 训练网络,但出现以下错误。
Traceback (most recent call last):
File "main.py", line 51, in <module>
outputs = cnn(inputs)
File "/home/daniel/anaconda3/envs/pytorch/lib/python3.5/site-packages/torch/nn/modules/module.py", line 357, in __call__
result = self.forward(*input, **kwargs)
File "/home/daniel/Code/kaggle-competitions/digit-recognizer/Net.py", line 40, in forward
x = self.pool(F.relu(self.conv[i](x)))
File "/home/daniel/anaconda3/envs/pytorch/lib/python3.5/site-packages/torch/nn/modules/module.py", line 357, in __call__
result = self.forward(*input, **kwargs)
File "/home/daniel/anaconda3/envs/pytorch/lib/python3.5/site-packages/torch/nn/modules/conv.py", line 282, in forward
self.padding, self.dilation, self.groups)
File "/home/daniel/anaconda3/envs/pytorch/lib/python3.5/site-packages/torch/nn/functional.py", line 90, in conv2d
return f(input, weight, bias)
RuntimeError: Input type (CUDAFloatTensor) and weight type (CPUFloatTensor) should be the …Run Code Online (Sandbox Code Playgroud)