如何用pip安装请求模块? pip是否正确安装?

时间:2014-05-13 20:30:45

标签: python macos python-2.7 pip

我不知道pip是否已正确安装。 我用过easy_install

它将pip脚本安装到: /Library/Frameworks/Python.framework/Versions/2.7/bin

然而,当我进入" pip"我得到一个命令列表和一般选项 不是错误

但是当我尝试安装请求时,我得到了:

Downloading/unpacking requests
Cannot fetch index base URL (https://pypi.python.org/simple/).
Could not find any downloads that satisfy the requirement requests

$ python get-pip.py
Downloading/unpacking pip
Cannot fetch index base URL (https: //pypi.python. org/simple/).
Could not find any downloads that satisfy the requirement pip
Cleaning up...
No distributions at all found for pip
Storing debug log for failure in /Users/ariannaroyrp/.pip/pip.log


$ sudo python get-pip.py

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Downloading/unpacking pip
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pip
Cleaning up...
No distributions at all found for pip
Storing debug log for failure in /Users/ariannapryor/.pip/pip.log

$ sudo python ez_install pip
Password:
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacO/Python: can't open file 'ez_install': [Errno 2] No such file or directory


$ sudo python easy_install pip
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacO/Python: can't open file 'easy_install': [Errno 2] No such file or directory

$ easy_install pip
Searching for pip
Reading https: // pypi.python. org/simple/pip

Best match: pip 1.5.5
Downloading https: // pypi.python. org/packages/source/p/pip/pip-1.5.5.tar.gz#md5=7520581ba0687dec1ce85bd15496537b
Processing pip-1.5.5.tar.gz
Writing /var/folders/4x/15s0yxd96gd1lt_6xf1zt_x40000gn/T/easy_install-OwdJ8U/pip-1.5.5/setup.cfg
Running pip-1.5.5/setup.py -q bdist_egg --dist-dir /var/folders/4x/15s0yxd96gd1lt_6xf1zt_x40000gn/T/easy_install-OwdJ8U/pip-1.5.5/egg-dist-tmp-xzS1S9
warning: no files found matching 'pip/cacert.pem'
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.rst' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 1.5.5 to easy-install.pth file
Installing pip script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installing pip2.7 script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installing pip2 script to /Library/Frameworks/Python.framework/Versions/2.7/bin

Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.5-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

$ pip install requests
Downloading/unpacking requests
Cannot fetch index base URL https:// pypi.python. org/simple/
Could not find any downloads that satisfy the requirement requests
Cleaning up...
No distributions at all found for requests
Storing debug log for failure in /Users/ariannaroyrp/.pip/pip.log

$ pip

Usage:   
  pip <command> [options]

Commands:
  install                     Install packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  zip                         DEPRECATED. Zip individual packages.
  unzip                       DEPRECATED. Unzip individual packages.
  bundle                      DEPRECATED. Create pybundles.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output.
  --log-file <path>           Path to a verbose non-appending log, that only logs failures. This log
                          is active by default at /Users/ariannapryor/.pip/pip.log.
  --log <path>                Path to a verbose appending log. This log is inactive by default.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe,
                          (b)ackup.
  --cert <path>               Path to alternate CA bundle.


$ pip install requests
Downloading/unpacking requests
  Cannot fetch index base URL https:// pypi.python. org/simple/
  Could not find any downloads that satisfy the requirement requests
Cleaning up...
No distributions at all found for requests
Storing debug log for failure in /Users/ariannaroyrp/.pip/pip.log

有人可以向我解释这里发生了什么吗?

1 个答案:

答案 0 :(得分:1)

您的所有邮件都报告了同样的问题:

Cannot fetch index base URL https:// pypi.python. org/simple/

注意https://pypi...

之间的空格

看起来你已经配置了某个--index并且它的值不正确。

最好是删除所有影响配置的方法并以“干净”方式运行

Configuration描述了以下方法

  • 配置文件
  • 环境变化

由于命令行开关优先,您可以尝试:

$ pip install requests --index "http://pypi.python.org/"

但如果你成功了,你肯定会研究,你搞砸了你的pip配置。