【问题标题】:getting a 403 error when fetching a zip file in pip在 pip 中获取 zip 文件时出现 403 错误
【发布时间】:2019-06-04 16:48:39
【问题描述】:

我正在使用requirements.txt 文件中的 url 安装带有 pip 的 python 包:

https://devdownloads.protopixel.net/python_dependencies/pyOSC-0.3.5b-5294.zip

运行 pip install -r requirements 会导致 403 错误:

(testenv) protopixel@ppxnode-421E2FF:~/proto_light_simulator/snap$ pip install -r requirements.txt
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting https://devdownloads.protopixel.net/python_dependencies/pyOSC-0.3.5b-5294.zip (from -r requirements.txt (line 1))
  ERROR: HTTP error 403 while getting https://devdownloads.protopixel.net/python_dependencies/pyOSC-0.3.5b-5294.zip
  ERROR: Could not install requirement https://devdownloads.protopixel.net/python_dependencies/pyOSC-0.3.5b-5294.zip (from -r requirements.txt (line 1)) because of error 403 Client Error: Forbidden for url: https://devdownloads.protopixel.net/python_dependencies/pyOSC-0.3.5b-5294.zip
ERROR: Could not install requirement https://devdownloads.protopixel.net/python_dependencies/pyOSC-0.3.5b-5294.zip (from -r requirements.txt (line 1)) because of HTTP error 403 Client Error: Forbidden for url: https://devdownloads.protopixel.net/python_dependencies/pyOSC-0.3.5b-5294.zip for URL https://devdownloads.protopixel.net/python_dependencies/pyOSC-0.3.5b-5294.zip

不过,一个简单的 wget 就可以了。

我很困惑这是 pip 方面的问题、与操作系统相关的问题还是服务器配置问题 (Apache)。关于如何调试的任何见解?

【问题讨论】:

  • 我可以确认问题。 curlwget 下载文件就好了,但 pip 没有。该站点似乎专门阻止pip 下载文件,或者它可能拒绝任何未知的下载代理。只有网站的管理员可以说。你可以试试其他 Python 包管理器,比如 pipenv

标签: python apache pip http-status-code-403


【解决方案1】:

让 pip 完成这项工作。在 Ubuntu Xenial 容器中测试:

root@9f411ba3b846:/# pip install pyOSC
Collecting pyOSC
  Downloading https://files.pythonhosted.org/packages/7c/e4/6abb118cf110813a7922119ed0d53e5fe51c570296785ec2a39f37606d85/pyOSC-0.3.5b-5294.tar.gz
Building wheels for collected packages: pyOSC
  Running setup.py bdist_wheel for pyOSC ... done
  Stored in directory: /root/.cache/pip/wheels/df/6a/66/769db4893bd6f5b52d1640661f2fcdee9c49b62e4b934b4686
Successfully built pyOSC
Installing collected packages: pyOSC
Successfully installed pyOSC-0.3.5b5294

【讨论】:

    猜你喜欢
    • 2017-07-08
    • 2018-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多