模块不发现错误:没有名为“请求”的模块,即使在 Pycharm 中安装了 pip 请求

以前“请求”库正在工作,但我想做一个项目并安装一些库,并且“request==2.22.0”包含在库中。安装库后,我发现我在PyCharm上收到一个错误:


Traceback (most recent call last):

  File "C:/Users/User/Desktop/python/projects/youtube downloader.py", line 5, in <module>

    import requests

ModuleNotFoundError: No module named 'requests'

当我尝试使用pip再次安装请求时,我不断收到这些错误,我也尝试卸载请求,然后重新安装:


C:\Users\User>pip3 install requests

Requirement already satisfied: requests in c:\users\muffin\anaconda3\lib\site-packages (2.21.0)

Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (3.0.4)

Requirement already satisfied: idna<2.9,>=2.5 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (2.8)

Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (1.24.1)

Requirement already satisfied: certifi>=2017.4.17 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (2018.11.29)


C:\Users\User>pip install requests

Requirement already satisfied: requests in c:\users\muffin\anaconda3\lib\site-packages (2.21.0)

Requirement already satisfied: idna<2.9,>=2.5 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (2.8)

Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (3.0.4)

Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (1.24.1)

Requirement already satisfied: certifi>=2017.4.17 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (2018.11.29)

我注意到我有两个?我的电脑里有蟒蛇,但我从来没有知道我应该用两条蟒蛇做什么(我用Ananconda来表示木星笔记本和PyCharm),我假设这可能是为什么pip不能像我预期的那样工作的问题......还是不行。我很困惑。


++所以我在木星笔记本上发现,我可以毫无问题地导入请求库,所以我认为我需要在另一条路径上下载库???..


任何人都可以帮忙吗?提前非常感谢你。


SMILET
浏览 101回答 1
1回答

呼唤远方

您尚未为 PyCharm 配置蟒蛇解释器。按照本教程,你应该没问题。我建议使用蟒蛇并创建一个虚拟环境,无论是手动还是在PyCharm内部。安装到该环境。requests
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python