Pytorch问题:ModuleNotFoundError: No module named ‘torchnet‘ , ‘pip._internal‘已解决

bug1: ModuleNotFoundError: No module named 'pip._internal'

出错提示: 

File "D:\app\anaconda\envs\pytorch_gpu\Scripts\pip.exe\__main__.py", line 4, in 
ModuleNotFoundError: No module named 'pip._internal'

解决:
       找到提示的路径(D:\app\anaconda\envs\pytorch_gpu\Scripts\)下的pip.exe,删了。

       然后用下边两句强制重新安装:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall

       然后会报下边这个警告,升级一下pip:

You should consider upgrading via the 'd:\app\anaconda\python.exe -m pip install --upgrade pip' command.

解决:

pip install --upgrade pip -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple

安装成功~

No module named 'pip._internal'问题已解决~~~


bug2: ModuleNotFoundError: No module named 'torchnet'

程序报错:

from  torchnet import meter

ModuleNotFoundError: No module named 'torchnet'  

解决:

搜了网上的教程,提示

>pip install git+https://github.com/pytorch/tnt.git@master -i http://pypi.douban.com/simple/ --trusted-host=pypi.do
uban.com/simple
pip install --upgrade git+https://github.com/pytorch/tnt.git@master
 

报错:

WARNING: Discarding git+https://github.com/pytorch/tnt.git@master. Command errored out with exit status 128: git clone -q ht
tps://github.com/pytorch/tnt.git 'C:\Users\malan\AppData\Local\Temp\pip-req-build-y4_h9lx9' Check the logs for full command
output.
ERROR: Command errored out with exit status 128: git clone -q https://github.com/pytorch/tnt.git 'C:\Users\malan\AppData\Loc
al\Temp\pip-req-build-y4_h9lx9' Check the logs for full command output.
 

 

1、直接用pip install torchnet

报错:

Requirement already satisfied: torchnet in d:\app\anaconda\lib\site-packages (0.0.5.1)
Requirement already satisfied: future in d:\app\anaconda\lib\site-packages (from torchnet) (0.18.2)
Requirement already satisfied: torch in d:\app\anaconda\lib\site-packages (from torchnet) (1.8.1)
already satisfied: certifi>=2017.4.17 in d:\app\anaconda\lib\site-packages (from requests->visdom->torchnet)
(2020.12.5)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in d:\app\anaconda\lib\site-packages (from request
s->visdom->torchnet) (1.22)

解决:首先得Make sure you have PyTorch installed, then do: 

pip uninstall torchnet

需要指定到pytorch所在的文件路径下

pip install --target=D:\app\anaconda\envs\pytorch_gpu\Lib\site-
packages  -i https://pypi.doubanio.com/simple/  --trusted-host pypi.doubanio.com  torchnet
 

Pytorch问题:ModuleNotFoundError: No module named ‘torchnet‘ , ‘pip._internal‘已解决_第1张图片

already satisfied: certifi>=2017.4.17 in d:\app\anaconda\lib\site-packages (from requests->visdom->torchnet)
(2020.12.5)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in d:\app\anaconda\lib\site-packages (from request
s->visdom->torchnet) (1.22)
 

 

参考:

https://blog.csdn.net/weixin_45043549/article/details/104371704

https://github.com/pytorch/tnt

你可能感兴趣的:(pytorch,bug调试,bug,pytorch)