Heroku --->安装pip remote:AttributeError:module' pip._vendor.requests'没有属性'会话'

时间:2018-04-14 15:48:42

标签: python django heroku

正在部署Python 3.6 Django == 11应用程序,并且定期推送代码直到昨天。现在我有错误:

  

remote:AttributeError:module' pip._vendor.requests'没有属性'会话'

整个追踪:

File "/tmp/build_989d7449dd0cd18694a87448cb09f19f/indexapp/image_processing.py", line 7, in <module>
remote:            import cv2
remote:        ModuleNotFoundError: No module named 'cv2'

另一个问题 - 我上面看到的是OpenCv [cv2]不存在于默认构建DIR中。我正在为此部署Python OpenCV buildpack的过程中 - 但需要首先解决此问题:

Select t1.*               --taking data just from one table
from one_table t1
inner join other_table t2
on t1.pk = t2.fk

2 个答案:

答案 0 :(得分:13)

我遇到了同样的错误:

AttributeError: module 'pip._vendor.requests' has no attribute 'Session'

清除Heroku构建缓存为我解决了这个问题。以下是您需要做的事情:

  1. 安装官方heroku-repo plugin for the Heroku CLI

    $ heroku plugins:install heroku-repo
    
  2. 清除应用的构建缓存:

    $ heroku repo:purge_cache -a APPNAME
    
  3. 触发部署以重建您的应用

  4. 清除构建缓存会导致pip在下一次构建时从头开始重新安装Python依赖项,而不是尝试升级当前的依赖项集。

    这为我解决了AttributeError,希望这有帮助!

答案 1 :(得分:0)

为了摆脱这种情况,我刚刚将from pip._vendor import requests更改为import requests

我在这里找到了解决方案:GitHub: AttributeError: module 'pip._vendor.requests' has no attribute 'Session' #5267