Heroku 找不到 pip(非常奇怪)

5 投票
1 回答
1351 浏览
提问于 2025-04-17 19:17

当我推送代码到主分支时,出现了这个问题:

Counting objects: 1, done.
Writing objects: 100% (1/1), 186 bytes, done.
Total 1 (delta 0), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> Python app detected
-----> Preparing Python runtime (python-2.7.3)
-----> Installing Distribute (0.6.35)
-----> Installing Pip (1.3.1)
-----> Installing dependencies using Pip (1.3.1)
/tmp/buildpack_12iaablbmqzbb/bin/compile: line 164: /app/.heroku/python/bin/pip: No such file or directory
 !     Heroku push rejected, failed to compile Python app

To git@heroku.com:xxxxxxxxxx.git
 ! [remote rejected] master -> master (pre-receive hook declined)

我想说明一下,我指定了构建包,因为Heroku错误地把我的Python应用识别成了Ruby应用,这是因为有一个Gemfile文件。

这是我从 heroku config 获取的配置:

BUILDPACK_URL: https://github.com/heroku/heroku-buildpack-python

但是这还是没能成功编译我的应用,我该怎么解决这个问题呢?

谢谢。

1 个回答

0

问题是pip找不到依赖包。你可以尝试以下方法:

virtualenv --no-site-packages venv

使用virtualenv --no-site-packages,看看pip是否还在找全局包?

撰写回答