You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何更新从Git安装的Python自定义包版本?

解决Pipenv更新Git托管自定义Python包的问题

方法一:强制指定包更新

在测试项目的终端执行以下命令,强制拉取仓库最新代码并更新包:

pipenv install git+https://github.com/vincent2303/myCustomPackage.git#egg=myCustomPackage --upgrade

方法二:修改Pipfile后同步依赖

  1. 打开项目根目录的Pipfile,找到对应包的配置行,确保格式为:
    myCustomPackage = {git = "https://github.com/vincent2303/myCustomPackage.git", editable = false}
    
    删掉可能存在的commit哈希、固定版本号等限制项。
  2. 执行同步命令清空缓存并重新拉取:
    pipenv sync --dev --clear
    

方法三:卸载后重装

如果前两种方法无效,先卸载旧版本:

pipenv uninstall myCustomPackage

再重新安装最新版本:

pipenv install git+https://github.com/vincent2303/myCustomPackage.git#egg=myCustomPackage

关键注意事项

  • 确认Git仓库已推送更新后的setup.py(版本号0.0.2)和say_bar函数代码。
  • 若之前用了editable编辑模式安装包,本地代码会自动同步仓库更新;非编辑模式必须通过上述方法触发更新。

内容的提问来源于stack exchange,提问作者Vince M

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 09:07:03