【问题标题】:Having a lot of trouble getting pip installed on Mac OS X在 Mac OS X 上安装 pip 遇到很多麻烦
【发布时间】:2014-08-28 05:49:48
【问题描述】:

我正在尝试使用数据表示服务 (BigML),该服务向其客户提供 REST 样式的 API。我必须使用 Python 2.7 使用这个 API,为了安装它,我需要 pip。但是,即使在过去 3 小时内测试了该网站的解决方案后,我似乎也无法在我的一生中正确安装 pip。所以这就是我到目前为止所尝试的......

1.) 我按照此页面上的说明进行操作:https://pip.pypa.io/en/latest/installing.html。下载“get-pip.py”文件并运行$ python "desktop/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/user/.pip/pip.log

如果有用,这里是错误日志:

desktop/get-pip.py run on Mon Jul  7 12:21:14 2014
Downloading/unpacking pip
Getting page https://pypi.python.org/simple/pip/
Could not fetch URL https://pypi.python.org/simple/pip/: connection error: [Errno 1] _      ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Will skip URL https://pypi.python.org/simple/pip/ when looking for download links for pip
Getting page https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/: connection error:   HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url:   /simple/ (Caused by <class 'httplib.CannotSendRequest'>: )
Will skip URL https://pypi.python.org/simple/ when looking for download links for pip
Cannot fetch index base URL https://pypi.python.org/simple/
URLs to search for versions for pip:
* https://pypi.python.org/simple/pip/
Getting page https://pypi.python.org/simple/pip/
Could not fetch URL https://pypi.python.org/simple/pip/: connection error: [Errno 1]   _ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify    failed
Will skip URL https://pypi.python.org/simple/pip/ when looking for download links for pip
Could not find any downloads that satisfy the requirement pip
Cleaning up...
Removing temporary dir /private/var/folders/7t/dnjmslbd0jn2s5wbgj1tnsjc0000gn/T/pip_build_user...
No distributions at all found for pip
Exception information:
Traceback (most recent call last):
 File   "/var/folders/7t/dnjmslbd0jn2s5wbgj1tnsjc0000gn/T/tmpU5dERi/pip.zip/pip/basecommand.py", line 122, in main
status = self.run(options, args)
 File  "/var/folders/7t/dnjmslbd0jn2s5wbgj1tnsjc0000gn/T/tmpU5dERi/pip.zip/pip/commands/install.py" , line 278, in run
 requirement_set.prepare_files(finder, force_root_egg_info=self.bundle,   bundle=self.bundle)
 File "/var/folders/7t/dnjmslbd0jn2s5wbgj1tnsjc0000gn/T/tmpU5dERi/pip.zip/pip/req.py",   line 1177, in prepare_files
 url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
 File "/var/folders/7t/dnjmslbd0jn2s5wbgj1tnsjc0000gn/T/tmpU5dERi/pip.zip/pip/index.py",  line 277, in find_requirement
 raise DistributionNotFound('No distributions at all found for %s' % req)
 DistributionNotFound: No distributions at all found for pip

2.) 我尝试sudo easy_install pip 并收到以下错误消息:

error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 2] No such file or directory: '/Library/Python/2.7/site-packages/test-easy-install-30930.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/Library/Python/2.7/site-packages/

This directory does not currently exist.  Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).

3.) 然后我尝试下载 Python 3.4.1,因为 pip 附带了它,我想我只是想看看我是否可以使用它并希望没有不兼容性,但即便如此,当我运行 pip help is 表示找不到该命令。

4.) 我尝试弄乱代理,以及我在对同一问题的其他回复中发现的许多其他随机终端命令。似乎没有任何效果。

如果您不知道,我在这种终端/Unix-ish 类型的环境中不是很有经验,所以我非常感谢您对这个问题的任何见解。非常感谢!

【问题讨论】:

    标签: python macos python-2.7 terminal pip


    【解决方案1】:

    我在我的 Linux 机器上遇到了这个问题,与 OSX 非常相似。

    我需要做的就是从你的包管理器获取最新的 python 版本。版本 3.x 我使用的是 2.7.3 的默认 python 安装,但这不起作用。 2.7.3 是 debian 和 OSX 上的默认值。

    aptitude install python3
    

    以上 - 在我的 debian 机器上。对于 OSX,请从 python 的网站获取 dmg(最新版本 3)。

    https://www.python.org/downloads/mac-osx/
    

    双击安装程序并按照说明在 Mac 上安装 Python 3.x。

    现在,当你打开终端并输入

    python --version
    

    2.7 仍然出现。要打开刚刚安装的版本,请输入“python3”,这将打开最新版本的 Python 3.x.x。

    所以要安装 pip

    python3 get-pip.py
    

    它应该处理任何“无法获取 URL”的问题。无论您在哪里运行 python 和处理 python 代码,您现在都可以使用最新版本 3.x。只要确保首先调用 python3 而不是 python。

    【讨论】:

      【解决方案2】:

      你上网时需要代理吗?如果需要,请在终端中设置您的代理。 或者您可能需要在命令中添加一个参数: pip install -U pip,就像文档中提到的一样,

      【讨论】:

        【解决方案3】:

        确保您在安装 pip 时已连接到互联网,因为它还会下载并安装“分发”。

        如果您无法在 python 3.4.1 上运行 pip,请尝试将以下内容添加到您的路径中

        C:/python34/scripts
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-09-29
          • 2015-12-06
          • 2017-04-05
          • 2013-09-03
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-05-30
          相关资源
          最近更新 更多