ImportError:没有名为requests的模块 - 即使它已安装

时间:2018-01-30 10:20:07

标签: python macos python-2.7

我正在运行Mac OS XPython(版本2.7)。 显然我缺少requests,但应该安装它。

$ python setup.py 
Traceback (most recent call last):
  File "setup.py", line 1, in <module>
    import requests
ImportError: No module named requests

$ pip install requests
Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/site-packages (from requests)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests)

1 个答案:

答案 0 :(得分:1)

alias python=/usr/local/bin/python3解决了这个问题..