[英]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.