使用 anaconda 安装请求库

0 python pip python-3.x anaconda

我尝试使用 sudo pip install requests 但终端不断指出:

(base) OSX-MacBook-Pro:~ osx$ sudo pip install requests
WARNING: The directory '/Users/osx/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/Users/osx/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: requests in /anaconda3/lib/python3.7/site-packages (2.22.0)
Requirement already satisfied: certifi>=2017.4.17 in /anaconda3/lib/python3.7/site-packages (from requests) (2019.9.11)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /anaconda3/lib/python3.7/site-packages (from requests) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /anaconda3/lib/python3.7/site-packages (from requests) (1.24.2)
Requirement already satisfied: idna<2.9,>=2.5 in /anaconda3/lib/python3.7/site-packages (from requests) (2.8)
Run Code Online (Sandbox Code Playgroud)

P/s: 我之前已经安装了 Anaconda 并且已经将其删除。

小智 5

  • 要在 Anaconda 环境中安装库,您应该这样做 conda install <library_name>
  • 要安装requests库,将是conda install requests