惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
爱范儿
爱范儿
P
Proofpoint News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
J
Java Code Geeks
宝玉的分享
宝玉的分享
Jina AI
Jina AI
B
Blog
N
Netflix TechBlog - Medium
Recent Announcements
Recent Announcements
aimingoo的专栏
aimingoo的专栏
腾讯CDC
C
Check Point Blog
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - Franky
罗磊的独立博客
B
Blog RSS Feed
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 叶小钗
M
MIT News - Artificial intelligence
GbyAI
GbyAI

博客园 - emanlee

Django3 核心入门知识点 HTML + CSS + JS 入门核心知识点 vs code 使用python,必须安装python解释器 Ubuntu 修改 ulimit‑n(nofile,最大打开文件数) 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 Word里打出“方框中间带勾”的符号 Windows 10/11 安装 MySQL 5.7 步骤(内部使用) Python编程语言的运行速度(CPU时间),与C语言对比 设置MySQL随操作系统Ubuntu启动 2026年秋季,2027年春季,西安理工大学 校历 博文阅读密码验证 - 博客园 Windows 11,用任务栏的搜索框搜索到一个软件,点击无法打开, 是bug 拆分视频的软件工具,Avidemux 开源免费 无法在此设备上加载驱动程序,可行可用 ubuntu 设置北京日期时间 mysql 在新电脑上导入,出现错误:ERROR at line 4019: Unknown command '\''. - emanlee 安装 yarn npm : 无法加载文件 C:\Program Files\nodejs\npm.ps1,因为在此系统上禁止运行脚本。 - emanlee VS code, 最近打开过哪些项目或文件夹,把这些备份下来,到另外一台电脑上恢复 傲梅分区助手 【好用】 ubuntu 可以使用Windows远程桌面连接吗?【可以】 把xshell的全部连接和密码,从一台Windows 10电脑,迁移到Windows11电脑。 Windows 远程桌面(mstsc)完整迁移方案(含历史连接记录、RDP 配置、保存的账号密码)【可行】 Endnote,如何能完整迁移库和模版 ubuntu 安装 locate
pip install django-ranged-response==0.2.0
emanlee · 2026-05-21 · via 博客园 - emanlee

(myvenv) root@aaa:~# pip install django-ranged-response==0.2.0 
Collecting django-ranged-response==0.2.0
  Using cached django-ranged-response-0.2.0.tar.gz (3.0 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [40 lines of output]
      running egg_info
      creating /tmp/pip-pip-egg-info-btfejxwz/django_ranged_response.egg-info
      writing /tmp/pip-pip-egg-info-btfejxwz/django_ranged_response.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-pip-egg-info-btfejxwz/django_ranged_response.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-pip-egg-info-btfejxwz/django_ranged_response.egg-info/requires.txt
      writing top-level names to /tmp/pip-pip-egg-info-btfejxwz/django_ranged_response.egg-info/top_level.txt
      writing manifest file '/tmp/pip-pip-egg-info-btfejxwz/django_ranged_response.egg-info/SOURCES.txt'
      reading manifest file '/tmp/pip-pip-egg-info-btfejxwz/django_ranged_response.egg-info/SOURCES.txt'
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-4r40ycmm/django-ranged-response_a4f5d737fbd241e0aaff21e2fbabd40b/setup.py", line 5, in <module>
          setup(
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/__init__.py", line 117, in setup
          return distutils.core.setup(**attrs)
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 183, in setup
          return run_commands(dist)
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 199, in run_commands
          dist.run_commands()
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
          self.run_command(cmd)
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/dist.py", line 999, in run_command
          super().run_command(command)
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
          cmd_obj.run()
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 312, in run
          self.find_sources()
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 320, in find_sources
          mm.run()
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 546, in run
          self.prune_file_list()
        File "/home/guolei/backend/myvenv/lib/python3.8/site-packages/setuptools/command/sdist.py", line 162, in prune_file_list
          super().prune_file_list()
        File "/home/guolei/backend/myvenv/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 380, in prune_file_list
          base_dir = self.distribution.get_fullname()
        File "/home/guolei/backend/myvenv/lib/python3.8/site-packages/setuptools/_core_metadata.py", line 267, in get_fullname
          return _distribution_fullname(self.get_name(), self.get_version())
        File "/home/glei/backend/myvenv/lib/python3.8/site-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname
          canonicalize_version(version, strip_trailing_zero=False),
      TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

我看到你安装 django-ranged-response==0.2.0 时出现了setuptools 版本不兼容的报错,核心原因是:

这个旧包和你虚拟环境里新版 setuptools 不兼容,新版函数参数变了,导致安装失败

最简单、最稳妥的解决方法

直接在你的虚拟环境里执行这2 条命令

# 降级 setuptools 到兼容版本
pip install setuptools==57.5.0

# 重新安装目标包
pip install django-ranged-response==0.2.0

为什么会报错?

  • django-ranged-response==0.2.0非常老旧的包(2018 年)
  • 你虚拟环境里的 setuptools 版本太新,函数参数改了
  • 旧包调用 canonicalize_version() 时传了 strip_trailing_zero,新版已经不支持这个参数,直接报错

额外建议(避免以后再踩坑)

如果你之后还要安装其他旧 Python 包,可以一并把 wheel 也固定成稳定版:

pip install setuptools==57.5.0 wheel==0.37.1

总结

  1. 报错根源:新版 setuptools 不兼容旧包
  2. 解决:降级 setuptools == 57.5.0
  3. 再重新安装目标包即可成功