Python 安装requests[socks]

通常情况下如下安装:

# pip install requests[socks]
$ pip3 install requests[socks]
zsh: no matches found: requests[socks]

如上所述,命令不能识别requests[socks]

解决办法:将requests[socks]看作整体,用引号包裹:

pip3 install 'requests[socks]'

打印如下信息安装成功:也可使用pip3 list查看

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: requests[socks] in ./Library/Python/3.7/lib/python/site-packages (2.24.0)
Requirement already satisfied: chardet<4,>=3.0.2 in ./Library/Python/3.7/lib/python/site-packages (from requests[socks]) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./Library/Python/3.7/lib/python/site-packages (from requests[socks]) (1.25.10)
Requirement already satisfied: certifi>=2017.4.17 in ./Library/Python/3.7/lib/python/site-packages (from requests[socks]) (2020.6.20)
Requirement already satisfied: idna<3,>=2.5 in ./Library/Python/3.7/lib/python/site-packages (from requests[socks]) (2.10)
Collecting PySocks!=1.5.7,>=1.5.6; extra == "socks"
  Downloading PySocks-1.7.1-py3-none-any.whl (16 kB)
Installing collected packages: PySocks
Successfully installed PySocks-1.7.1

猜你喜欢

转载自blog.csdn.net/qq_24256877/article/details/107618686