一、问题
在windows10上通过pip安装requests报错
C:UsersAdministrator>pip install requests
Fatal error in launcher: Unable to create process using '"'
二、解决办法
前面加python -m
C:UsersAdministrator>python -m pip install requests
Requirement already satisfied: requests in c:windowslibsite-packages
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:windowslibsite-packages (from requests)
Requirement already satisfied: certifi>=2017.4.17 in c:windowslibsite-packages (from requests)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in c:windowslibsite-packages (from requests)
Requirement already satisfied: idna<2.8,>=2.5 in c:windowslibsite-packages (from requests)
You are using pip version 18.0, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
这里提示pip需要更新,我们执行python -m pip install --upgrade pip
命令更新:
C:UsersAdministrator>python -m pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 160kB/s
Installing collected packages: pip
Found existing installation: pip 18.0
Uninstalling pip-18.0:
Successfully uninstalled pip-18.0
Successfully installed pip-19.0.3
更新成功后,再执行pip install requests
,发现虽然提示已安装,但是已经不会报错了。
C:UsersAdministrator>pip install requests
Requirement already satisfied: requests in c:windowslibsite-packages (2.19.1)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in c:windowslibsite-packages (from requests) (1.23)
Requirement already satisfied: certifi>=2017.4.17 in c:windowslibsite-packages (from requests) (2018.8.24)
Requirement already satisfied: idna<2.8,>=2.5 in c:windowslibsite-packages (from requests) (2.7)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:windowslibsite-packages (from requests) (3.0.4)