Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用pip安装请求模块?pip是否正确安装?_Python_Macos_Python 2.7_Pip - Fatal编程技术网

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

Python 如何使用pip安装请求模块?pip是否正确安装?,python,macos,python-2.7,pip,Python,Macos,Python 2.7,Pip,我不知道pip是否安装正确。 我用的是简易安装 它将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

我不知道pip是否安装正确。 我用的是简易安装

它将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
下载/解包请求
无法获取索引基URL(https://pypi.python.org/simple/).
找不到任何满足需求请求的下载
$python get-pip.py
下载/解包pip
无法获取索引基URL(https://pypi.python.org/simple/)。
找不到任何满足pip要求的下载
清理。。。
没有找到pip的任何分布
在/Users/ariannaroyrp/.pip/pip.log中存储故障调试日志
$sudo python get-pip.py
警告:不正确使用sudo命令可能导致数据丢失
或删除重要的系统文件。请仔细检查你的护照
使用sudo时键入。有关详细信息,请键入“man sudo”。
要继续,请输入密码,或键入Ctrl-C中止。
密码:
下载/解包pip
无法获取索引基URLhttps://pypi.python.org/simple/
找不到任何满足pip要求的下载
清理。。。
没有找到pip的任何分布
在/Users/ariannapyror/.pip/pip.log中存储故障调试日志
$sudo python ez_安装pip
密码:
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacO/Python:无法打开文件“ez_install”:[Errno 2]没有这样的文件或目录
$sudo python轻松安装pip
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacO/Python:无法打开文件“easy_install”:[Errno 2]没有这样的文件或目录
$easy\u安装pip
搜索pip
阅读https://pypi.python。org/simple/pip
最佳对手:皮普1.5.5
下载https://pypi.python。org/packages/source/p/pip/pip-1.5.5.tar.gz#md5=7520581ba0687dec1ce85bd15496537b
加工pip-1.5.5.tar.gz
正在写入/var/folders/4x/15s0yxd96gd1lt_6xf1zt_x40000gn/T/easy_install-OwdJ8U/pip-1.5.5/setup.cfg
运行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
警告:未找到与“pip/cacert.pem”匹配的文件
警告:在目录“docs”下找不到与“*.html”匹配的文件
警告:在目录“docs/\u build”下找不到以前包含的与“*.rst”匹配的文件
未找到以前包含的与“docs/\u build/\u sources”匹配的目录
将pip 1.5.5添加到easy-install.pth文件
将pip脚本安装到/Library/Frameworks/Python.framework/Versions/2.7/bin
将pip2.7脚本安装到/Library/Frameworks/Python.framework/Versions/2.7/bin
将pip2脚本安装到/Library/Frameworks/Python.framework/Versions/2.7/bin
已安装/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.5-py2.7.egg
处理pip的依赖项
已完成处理pip的依赖项
$pip安装请求
下载/解包请求
无法获取索引基URL https://pypi.python。组织/简单/
找不到任何满足需求请求的下载
清理。。。
找不到任何用于请求的分发
在/Users/ariannaroyrp/.pip/pip.log中存储故障调试日志
$pip
用法:
pip[选项]
命令:
安装软件包。
卸载卸载包。
以需求格式冻结已安装的输出包。
列出已安装的软件包。
显示有关已安装软件包的信息。
在PyPI中搜索包。
车轮根据您的要求制造车轮。
不推荐使用zip。给每个包裹拉上拉链。
解压已弃用。解压各个包。
已弃用捆绑包。创建pybundle。
帮助显示命令的帮助。
一般选择:
-h、 --帮助表示帮助。
-v、 --详细-提供更多输出。该选项是附加选项,最多可使用3次。
-五、 --版本显示版本并退出。
-q、 --安静会减少输出。
--详细的非附加日志的日志文件路径,该日志仅记录故障。这个日志
默认情况下处于活动状态,位于/Users/ariannapyror/.pip/pip.log。
--详细附加日志的日志路径。默认情况下,此日志处于非活动状态。
--代理以[user:passwd@]proxy的形式指定代理。服务器:端口。
--超时设置套接字超时(默认为15秒)。
--存在操作路径已存在时的默认操作:(s)witch,(i)gnore,(w)ipe,
(b) 收起。
--备用CA束的证书路径。
$pip安装请求
下载/解包请求
无法获取索引基URL https://pypi.python。组织/简单/
找不到任何满足需求请求的下载
清理。。。
找不到任何用于请求的分发
在/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配置搞砸了。

Do
ping pypi.python.org
在终端上。你得到了什么?我真的结束了