简体   繁体   English

ModuleNotFoundError:pip安装后没有名为“请求”的模块

[英]ModuleNotFoundError: No module named 'requests' after pip install

I know similar questions have been asked before but I couldn't find the solution to my problem.我知道以前有人问过类似的问题,但我找不到解决问题的方法。

I am getting the following error message after trying to import requests:尝试导入请求后,我收到以下错误消息:

C:\Users\Jm\PycharmProjects\Test\venv\Scripts\python.exe C:/Users/Jm/PycharmProjects/Test/Test_001
Traceback (most recent call last):
  File "C:/Users/Jm/PycharmProjects/Test/Test_001", line 1, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

I only have one version of python installed and python -m pip install requests is saying all the requirements are already satisfied.我只安装了一个版本的 python 并且python -m pip install requests 说所有要求都已经满足。

Thanks in advance.提前致谢。

Run this code:运行此代码:

C:\Users\Jm\PycharmProjects\Test\venv\Scripts\python.exe -m pip install requests

This forces the installation directory to your python install.这会强制安装目录到您的 python 安装。

This gives a much different effect than simply python -m pip install requests这与简单的python -m pip install requests有很大不同的效果

As @Daniel Scott mentioned before use the command mentioned above or below正如@Daniel Scott 之前提到的,使用上面或下面提到的命令

$: path-to-your-python-command -m pip install name-of-module $: path-to-your-python-command -m pip install name-of-module

If you are using linux/mac then you can find path-to-your-python command using:如果您使用的是 linux/mac,那么您可以使用以下命令找到 path-to-your-python 命令:

$: which python3 $: 哪个python3

/usr/bin/python3 /usr/bin/python3

Lets say your python is installed here /usr/bin/python3 and the module you are installing is requests .假设您的 python 安装在这里/usr/bin/python3并且您正在安装的模块是requests Then you can use:然后你可以使用:

$: /usr/bin/python3 -m pip install requests $: /usr/bin/python3 -m pip 安装请求

暂无
暂无

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

相关问题 ModuleNotFoundError: 没有命名模块<modulename> pip安装后 - ModuleNotFoundError: No module named <modulename> after pip install ModuleNotFoundError:即使在 pip 在 Pycharm 中安装了请求后,也没有名为“请求”的模块 - ModuleNotFoundError: No module named 'requests' even after pip installed requests in Pycharm ModuleNotFoundError:即使在“pip3 install requests-html”和“requests_html”之后也没有名为“requests_html”的模块 - ModuleNotFoundError: No module named 'requests_html' even after 'pip3 install requests-html' and 'requests_html' ModuleNotFoundError:使用“pip install numpy”后没有名为“numpy”的模块 - ModuleNotFoundError: No module named 'numpy' after using 'pip install numpy' ModuleNotFoundError:在pip安装pyserial之后,没有名为“ serial”的模块 - ModuleNotFoundError: No module named 'serial' after pip install pyserial pip安装后出现“ ModuleNotFoundError:没有名为“ PyQt5”的模块” - “ModuleNotFoundError: No module named 'PyQt5'” after pip install ModuleNotFoundError: 执行 pip install xyz 后没有名为“xyz”的模块 - ModuleNotFoundError: No module named 'xyz' " after doing pip install xyz ModuleNotFoundError:即使在“pip install translate”之后,也没有名为“translate”的模块 - ModuleNotFoundError: No module named 'translate' , even after "pip install translate" Python:在pipenv中pip3安装请求之后“没有名为&#39;requests&#39;的模块” - Python: "No module named 'requests' " after pip3 install requests in pipenv pip安装错误:ModuleNotFoundError没有名为“ setuptools”的模块 - pip install error: ModuleNotFoundError No module named 'setuptools'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM