简体   繁体   English

ModuleNotFoundError:spyder 中没有名为“pip”的模块

[英]ModuleNotFoundError: No module named 'pip' in spyder

I tried to use torch in spyder but I got error ModuleNotFoundError: No module named 'torch' so I tried use pip module not in cmd but in spyder itself following我尝试在 spyder 中使用 torch 但出现错误ModuleNotFoundError: No module named 'torch'所以我尝试在 cmd 中使用 pip 模块但在 spyder 本身中

import pip
pip.main(["install","torch"])

but got ModuleNotFoundError: No module named 'pip' and I know I had successfully used it in spyder before but recent automatic spyder updates probably have caused this error so I tried to install pip in my all python environments in cmd with cd {environment_path} but the pip was installed there. but got ModuleNotFoundError: No module named 'pip' and I know I had successfully used it in spyder before but recent automatic spyder updates probably have caused this error so I tried to install pip in my all python environments in cmd with cd {environment_path} but pip 安装在那里。 I also used python -m ensurepip in all environments but I still get ModuleNotFoundError: No module named 'pip' .我还在所有环境中使用python -m ensurepip但我仍然得到ModuleNotFoundError: No module named 'pip'

seems the problem is caused by reseting spyder(maybe there other causes) changing different python interpreters (environments) also is no help.!似乎问题是由重置 spyder 引起的(可能还有其他原因)改变不同的 python 解释器(环境)也没有帮助。! and installing or reinstalling with windows installer solved problem for me.并使用 windows 安装程序安装或重新安装为我解决了问题。

update: after restarting again many modules like 'pip', 'torch' and 'keyboard' are not recognized and reinstalling is no answer(no difference between installing for 'this user' or 'all users').更新:再次重新启动后,许多模块(如“pip”、“火炬”和“键盘”)无法识别,重新安装没有答案(为“此用户”或“所有用户”安装没有区别)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM