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

  显示原文与译文双语对照的内容

我不知道pip是否安装正确。 我使用了 easy_install

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

但是,当我输入"皮普"时,会得到命令列表和常规选项,而不是错误

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


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

谁能给我解释一下这里发生了什么?

时间:

你的所有消息都报告了同样的问题:


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

注意 https://pypi... 之间的空间

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

最好的方法是移除影响配置的所有方法并运行"清理"路径

配置描述跟踪方法

  • 配置文件
  • 环境变化

当 命令行 开关优先时,你可以尝试:


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

但是如果你成功了,你一定会研究,你把你的pip配置搞乱了。

...