我已经在我的电脑上安装了pip3以及请求包。即使在我的shell上运行命令导入请求,我收到以下错误:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
我必须手动将所有包复制到我的工作目录以解决此异常。
答案 0 :(得分:2)
Find were your python is installed and find Scripts directory. Open cmd, go to this folder and type pip install requests
.
For me it was like below:
cd C:\Users\myLocalUserName\AppData\Local\Programs\Python\Python36\Scripts
pip install requests
答案 1 :(得分:0)
在 PyCharm 中,您应该:
答案 2 :(得分:0)
确保请求模块的版本应该以 2 开头
不正确
pip3 list
包版本
请求 0.0.1
我安装了这个并使用
python -m pip install requests
稍后:
PS C:\python\Scripts> 点列表
包版本
证书 2021.5.30
chardet 4.0.0
idna 2.10
点 21.1.3
请求 2.25.1
urllib3 1.26.6
答案 3 :(得分:0)
用于列出 Python 3 的已安装模块:
sudo pip3 list
用于为 Python 3 安装 request
模块:
sudo pip3 install requests
答案 4 :(得分:0)
激活虚拟环境 .\env\Scripts\activate 安装依赖,
pip 安装请求