内容目录
Windows环境下,使用python安装requests工具包时,使用 pip3 install requests
报错如下错误:
C:\Users\pc>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> pip3 install requests
File "<stdin>", line 1
pip3 install requests
原因是:pip3
是 Python 包管理工具,该工具是直接在cmd中运行的,不需要进入python环境中再运行
解决方法:执行exit()命令,退出python环境,然后重新输入pip3 install requests
命令,然后工具包就下载成功了
C:\Users\pc>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> pip3 install requests
File "<stdin>", line 1
pip3 install requests
SyntaxError: invalid syntax
>>> exit()
C:\Users\pc>pip3 install requests
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting requests
Downloading https://mirrors.aliyun.com/pypi/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl (62 kB)
|████████████████████████████████| 62 kB 122 kB/s
Collecting charset-normalizer<4,>=2
Downloading https://mirrors.aliyun.com/pypi/packages/09/b8/cf771dcdfe62453b5e59b05b85ab261df1da60b1bc10c7f260b468c62426/charset_normalizer-3.3.0-cp310-cp310-win_amd64.whl (98 kB)
|████████████████████████████████| 98 kB 1.1 MB/s
Collecting urllib3<3,>=1.21.1
Downloading https://mirrors.aliyun.com/pypi/packages/26/40/9957270221b6d3e9a3b92fdfba80dd5c9661ff45a664b47edd5d00f707f5/urllib3-2.0.6-py3-none-any.whl (123 kB)
|████████████████████████████████| 123 kB 152 kB/s
Collecting idna<4,>=2.5
Downloading https://mirrors.aliyun.com/pypi/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl (61 kB)
|████████████████████████████████| 61 kB 14 kB/s
Collecting certifi>=2017.4.17
Downloading https://mirrors.aliyun.com/pypi/packages/4c/dd/2234eab22353ffc7d94e8d13177aaa050113286e93e7b40eae01fbf7c3d9/certifi-2023.7.22-py3-none-any.whl (158 kB)
|████████████████████████████████| 158 kB 198 kB/s
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests
Successfully installed certifi-2023.7.22 charset-normalizer-3.3.0 idna-3.4 requests-2.31.0 urllib3-2.0.6
0 条评论
撰写评论