简体   繁体   English

ModuleNotFoundError:PyCharm 中没有名为“请求”的模块

[英]ModuleNotFoundError: No module named 'requests' in PyCharm

I have a python code in PyCharm in which i am using import requests but the terminal is showing me the following error:我在 PyCharm 中有一个 python 代码,我在其中使用导入请求,但终端显示以下错误:

(venv) ahmad@Ahmad:~/Desktop/Spiders$ python test.py Traceback (most recent call last): File "test.py", line 1, in import requests ModuleNotFoundError: No module named 'requests' (venv) ahmad@Ahmad:~/Desktop/Spiders$ python test.py Traceback(最近调用 last):文件“test.py”,第 1 行,在导入请求中 ModuleNotFoundError:没有名为“requests”的模块

But I have installed pip and requests as well.但我已经安装了 pip 和请求。

you can use this :你可以使用这个:

just go to file > sitting > project : name > project interpreter > add > search and install只需转到文件>坐>项目:名称>项目解释器>添加>搜索并安装

I am guessing you have not set your interpreter or installed the necessary packages in the interpreter in PyCharm.我猜你还没有在 PyCharm 的解释器中设置你的解释器或安装必要的包。

  • Can you check in your File -> Settings你可以检查你的File -> Settings
  • There, on the side panel, you can open your Project: < project_name > and check Project Interpreter在侧面板中,您可以打开您的项目:< project_name >并检查Project Interpreter

  • This will show the interpreter and the installed packages which you can use.这将显示您可以使用的解释器和已安装的软件包。

If the interpreter is empty, you need to add it.如果解释器为空,则需要添加它。

https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html

Hope this helps.希望这可以帮助。

You can just found the icon of Search in right highest corner and search for 'import modules'.您可以在右上角找到“搜索”图标并搜索“导入模块”。 Then click on " Project: [YOUR_PROJECT]" choose ' Python Interpreter ' and then click on 'plus' button.然后点击“项目: [YOUR_PROJECT]”选择“ Python解释器”,然后点击“加号”按钮。 Thus you can install 'requests' module manually.因此,您可以手动安装“请求”模块。

(Some sites say that you can call Search by pressing Alt + Enter, but it doesn`t work in my case) (有些网站说您可以按 Alt + Enter 调用Search ,但在我的情况下不起作用)

我不得不转到 CLi(命令行)并运行“>pip install requests”——这是在从 Pycharm 的“设置/解释器”gui 菜单尝试失败之后。

I followed the...我跟着...

settings > [projectname] > python interpreter > add interpreter设置 > [项目名称] > python 解释器 > 添加解释器

...steps described in other answers here. ...此处其他答案中描述的步骤。 I got the location of the 'requests' install I knew I'd successfully completed by going back to the terminal, and using我得到了“请求”安装的位置我知道我已经通过返回终端并使用

pip install requests pip 安装请求

again, and taking note of the install filepath from the 'Requirement already satisfied' output. Used that in the 'Settings...' step above, and voila!再次,并记下“要求已满足”output 中的安装文件路径。在上面的“设置...”步骤中使用了它,瞧!

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

相关问题 ModuleNotFoundError:即使在 pip 在 Pycharm 中安装了请求后,也没有名为“请求”的模块 - ModuleNotFoundError: No module named 'requests' even after pip installed requests in Pycharm pycharm 项目解释器有请求,但 ModuleNotFoundError: No module named &#39;requests&#39; - pycharm project interpreter has requests but ModuleNotFoundError: No module named 'requests' ModuleNotFoundError:没有名为“请求”的模块 - ModuleNotFoundError: No module named 'requests' ModuleNotFoundError:Pycharm 中没有名为“pandas”的模块 - ModuleNotFoundError: No module named 'pandas' in Pycharm ModuleNotFoundError: 没有名为“tkinter”/PyCharm 的模块 - ModuleNotFoundError: No module named 'tkinter' / PyCharm ModuleNotFoundError:Pycharm 中没有名为“dns”的模块 - ModuleNotFoundError: No module named 'dns' in Pycharm PyCharm ModuleNotFoundError: No module named 'turtle' - PyCharm ModuleNotFoundError: No module named 'turtle' Heroku:ModuleNotFoundError:没有名为“请求”的模块 - Heroku: ModuleNotFoundError :No module named 'requests' Python:ModuleNotFoundError:没有名为“请求”的模块 - Python: ModuleNotFoundError: No module named 'requests' ModuleNotFoundError:JENKINS 中没有名为请求的模块 - ModuleNotFoundError: No module named requests in JENKINS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM