这些apt-package为何在Ubuntu和Heroku上表现不一样?

克拉默65

我想Heroku使用来自Python的ZBar在常规的Ubuntu 14.04服务器上,我可以运行

sudo apt-get install python-qrtools

- 或者 -

sudo apt-get install zbar-tools
sudo apt-get install libzbar-dev
sudo apt-get install python-zbar

在第一个或最后三个之后,我可以import zbar通过Python执行。因此,使用heroku-buildpack-apt(与heroku-buildpack-multi结合使用)我尝试了两种选择。在这两种情况下,似乎都可以正确无误地正确安装所有内容(请参见下面的安装日志),但是在python命令行上尝试总是可以得到:

>>> import zbar
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named zbar

看到Heroku日志(如下所示)将Linux发行版列出为Ubuntu Trusty(= 14.04),我看不到为什么它可以在我自己的14.04安装中正常工作,但在Heroku上却不工作。

有人知道为什么这不起作用以及如何在Heroku上安装所需的软件包吗?欢迎所有提示!

尝试安装时的Heroku安装日志python-qrtools

remote: =====> Downloading Buildpack: https://github.com/ddollar/heroku-buildpack-apt
remote: =====> Detected Framework: Apt
remote: -----> Updating apt caches
remote:        Ign http://archive.ubuntu.com trusty InRelease
remote:        Ign http://archive.ubuntu.com trusty-security InRelease
remote:        Ign http://archive.ubuntu.com trusty-updates InRelease
remote:        Hit http://archive.ubuntu.com trusty Release.gpg
remote:        Hit http://archive.ubuntu.com trusty-security Release.gpg
remote:        Hit http://archive.ubuntu.com trusty-updates Release.gpg
remote:        Hit http://archive.ubuntu.com trusty Release
remote:        Hit http://archive.ubuntu.com trusty-security Release
remote:        Hit http://archive.ubuntu.com trusty-updates Release
remote:        Hit http://archive.ubuntu.com trusty/main amd64 Packages
remote:        Hit http://archive.ubuntu.com trusty/universe amd64 Packages
remote:        Hit http://archive.ubuntu.com trusty/main Translation-en
remote:        Hit http://archive.ubuntu.com trusty/universe Translation-en
remote:        Hit http://archive.ubuntu.com trusty-security/main amd64 Packages
remote:        Hit http://archive.ubuntu.com trusty-security/main Translation-en
remote:        Hit http://archive.ubuntu.com trusty-updates/main amd64 Packages
remote:        Hit http://archive.ubuntu.com trusty-updates/main Translation-en
remote:        Ign http://archive.ubuntu.com trusty/main Translation-en_US
remote:        Ign http://archive.ubuntu.com trusty/universe Translation-en_US
remote:        Reading package lists...
remote: -----> Fetching .debs for python-qrtools
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        The following extra packages will be installed:
remote:          libqrencode3 libv4l-0 libv4lconvert0 libwebp5 libwebpmux1 libzbar0
remote:          python-imaging python-pil python-zbar qrencode
remote:        Suggested packages:
remote:          python-pil-doc python-pil-dbg
remote:        The following NEW packages will be installed:
remote:          libqrencode3 libv4l-0 libv4lconvert0 libwebp5 libwebpmux1 libzbar0
remote:          python-imaging python-pil python-qrtools python-zbar qrencode
remote:        0 upgraded, 11 newly installed, 0 to remove and 81 not upgraded.
remote:        Need to get 0 B/721 kB of archives.
remote:        After this operation, 2,724 kB of additional disk space will be used.
remote:        Download complete and in download only mode
remote: -----> Installing libqrencode3_3.4.2-1_amd64.deb
remote: -----> Installing libv4l-0_1.0.1-1_amd64.deb
remote: -----> Installing libv4lconvert0_1.0.1-1_amd64.deb
remote: -----> Installing libwebp5_0.4.0-4_amd64.deb
remote: -----> Installing libwebpmux1_0.4.0-4_amd64.deb
remote: -----> Installing libzbar0_0.10+doc-9build1_amd64.deb
remote: -----> Installing python-imaging_2.3.0-1ubuntu3_all.deb
remote: -----> Installing python-pil_2.3.0-1ubuntu3_amd64.deb
remote: -----> Installing python-qrtools_1.4~bzr16-1ubuntu1_all.deb
remote: -----> Installing python-zbar_0.10+doc-9build1_amd64.deb
remote: -----> Installing qrencode_3.4.2-1_amd64.deb
remote: -----> Writing profile script
remote: =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-python.git
remote: =====> Detected Framework: Python
remote: -----> Installing dependencies with pip
remote:        Cleaning up...
remote:
remote: Using release configuration from last framework (Python).
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing... done, 39.4MB
remote: -----> Launching... done, v22
remote:        https://mysterious-man-1234.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.

尝试安装Heroku时的安装日志zbar-toolslibzbar-dev以及python-zbar

remote: =====> Downloading Buildpack: https://github.com/ddollar/heroku-buildpack-apt
remote: =====> Detected Framework: Apt
remote: -----> Updating apt caches
remote:        Ign http://archive.ubuntu.com trusty InRelease
remote:        Ign http://archive.ubuntu.com trusty-security InRelease
remote:        Ign http://archive.ubuntu.com trusty-updates InRelease
remote:        Hit http://archive.ubuntu.com trusty Release.gpg
remote:        Get:1 http://archive.ubuntu.com trusty-security Release.gpg [933 B]
remote:        Get:2 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]
remote:        Hit http://archive.ubuntu.com trusty Release
remote:        Get:3 http://archive.ubuntu.com trusty-security Release [62.0 kB]
remote:        Get:4 http://archive.ubuntu.com trusty-updates Release [62.0 kB]
remote:        Hit http://archive.ubuntu.com trusty/main amd64 Packages
remote:        Hit http://archive.ubuntu.com trusty/universe amd64 Packages
remote:        Hit http://archive.ubuntu.com trusty/main Translation-en
remote:        Hit http://archive.ubuntu.com trusty/universe Translation-en
remote:        Get:5 http://archive.ubuntu.com trusty-security/main amd64 Packages [181 kB]
remote:        Hit http://archive.ubuntu.com trusty-security/main Translation-en
remote:        Get:6 http://archive.ubuntu.com trusty-updates/main amd64 Packages [384 kB]
remote:        Hit http://archive.ubuntu.com trusty-updates/main Translation-en
remote:        Ign http://archive.ubuntu.com trusty/main Translation-en_US
remote:        Ign http://archive.ubuntu.com trusty/universe Translation-en_US
remote:        Fetched 691 kB in 3s (219 kB/s)
remote:        Reading package lists...
remote: -----> Fetching .debs for zbar-tools
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        The following extra packages will be installed:
remote:          libv4l-0 libv4lconvert0 libzbar0
remote:        The following NEW packages will be installed:
remote:          libv4l-0 libv4lconvert0 libzbar0 zbar-tools
remote:        0 upgraded, 4 newly installed, 0 to remove and 81 not upgraded.
remote:        Need to get 0 B/231 kB of archives.
remote:        After this operation, 861 kB of additional disk space will be used.
remote:        Download complete and in download only mode
remote: -----> Fetching .debs for libzbar-dev
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        The following extra packages will be installed:
remote:          libmagick++-dev libmagick++5 libv4l-0 libv4lconvert0 libzbar0
remote:        The following NEW packages will be installed:
remote:          libmagick++-dev libmagick++5 libv4l-0 libv4lconvert0 libzbar-dev libzbar0
remote:        0 upgraded, 6 newly installed, 0 to remove and 81 not upgraded.
remote:        Need to get 0 B/563 kB of archives.
remote:        After this operation, 2,980 kB of additional disk space will be used.
remote:        Download complete and in download only mode
remote: -----> Fetching .debs for python-zbar
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        The following extra packages will be installed:
remote:          libv4l-0 libv4lconvert0 libzbar0
remote:        The following NEW packages will be installed:
remote:          libv4l-0 libv4lconvert0 libzbar0 python-zbar
remote:        0 upgraded, 4 newly installed, 0 to remove and 81 not upgraded.
remote:        Need to get 0 B/225 kB of archives.
remote:        After this operation, 873 kB of additional disk space will be used.
remote:        Download complete and in download only mode
remote: -----> Installing libmagick++5_8%3a6.7.7.10-6ubuntu3_amd64.deb
remote: -----> Installing libmagick++-dev_8%3a6.7.7.10-6ubuntu3_amd64.deb
remote: -----> Installing libqrencode3_3.4.2-1_amd64.deb
remote: -----> Installing libv4l-0_1.0.1-1_amd64.deb
remote: -----> Installing libv4lconvert0_1.0.1-1_amd64.deb
remote: -----> Installing libwebp5_0.4.0-4_amd64.deb
remote: -----> Installing libwebpmux1_0.4.0-4_amd64.deb
remote: -----> Installing libzbar0_0.10+doc-9build1_amd64.deb
remote: -----> Installing libzbar-dev_0.10+doc-9build1_amd64.deb
remote: -----> Installing python-imaging_2.3.0-1ubuntu3_all.deb
remote: -----> Installing python-pil_2.3.0-1ubuntu3_amd64.deb
remote: -----> Installing python-qrtools_1.4~bzr16-1ubuntu1_all.deb
remote: -----> Installing python-zbar_0.10+doc-9build1_amd64.deb
remote: -----> Installing qrencode_3.4.2-1_amd64.deb
remote: -----> Installing zbar-tools_0.10+doc-9build1_amd64.deb
remote: -----> Writing profile script
remote: Using release configuration from last framework (Apt).
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing... done, 39.8MB
remote: -----> Launching... done, v24
remote:        https://mystery-man-1234.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
克拉默65

在@PadraicCunningham的惊人帮助下,我设法找到了解决方案。原来的问题是heroku-buildpack-apt将东西安装在一个新创建的文件夹中/app/.apt/,该文件夹不在PYTHONPATH中。

因此,我将相关文件夹添加到了heroku上的PYTHONPATH中,如下所示:

heroku config:add PYTHONPATH=/app/.apt/usr/lib/python2.7/dist-packages/

这解决了问题。再次非常感谢PadraicCunningham帮助我发现了这个问题!

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

这些功能定义不一样吗?

来自分类Dev

为什么这些评估方法不一样?

来自分类Dev

为什么熊猫的整数dtypes在Unix和Windows上表现不一样?

来自分类Dev

为什么这些Haskell函数的推断类型不一样?

来自分类Dev

为什么这些opengl矩形看起来不一样?

来自分类Dev

为什么比赛认为这些武器不一样?

来自分类Dev

与这些Ubuntu apt-get命令等效的Linux yum命令

来自分类Dev

为什么这些不一样?为什么在 C# 中`type.GetType() is Test` 不是真的?

来自分类Dev

:not()选择器在Safari和Chrome / Firefox之间表现不一样

来自分类Dev

在Windows Bash的Git中,如何安装“ get-apt”和“ sudo”以及所有这些基本命令?

来自分类Dev

为什么echo *表现得像ls而printf *表现得不一样?

来自分类Dev

ubuntu 13.10 amd 12.04 LTS和有什么不一样???和

来自分类Dev

ubuntu 13.10 amd 12.04 LTS和有什么不一样???和

来自分类Dev

with和env和有什么不一样

来自分类Dev

“ |”和有什么不一样 和“或”?

来自分类Dev

:和true和有什么不一样?

来自分类Dev

"this" 和 "::" 和有什么不一样?

来自分类Dev

这些都一样吗?

来自分类Dev

线程和有什么不一样

来自分类Dev

列表理解和for循环的结果不一样

来自分类Dev

SqlLite 和 MariaDb SELECT 的结果不一样

来自分类Dev

PHP 和 WebView - Cookie 不一样

来自分类Dev

过渡时间不一样

来自分类Dev

周末不一样的内容

来自分类Dev

ls和有什么不一样?grep * e *和ls | grep e

来自分类Dev

“ ||”和有什么不一样 和“或”在PHP中?

来自分类Dev

javascript Promise和q promise和有什么不一样

来自分类Dev

phpinfo()和有什么不一样?和PHP -i?

来自分类Dev

&!和有什么不一样?和&| 在zsh中?

Related 相关文章

  1. 1

    这些功能定义不一样吗?

  2. 2

    为什么这些评估方法不一样?

  3. 3

    为什么熊猫的整数dtypes在Unix和Windows上表现不一样?

  4. 4

    为什么这些Haskell函数的推断类型不一样?

  5. 5

    为什么这些opengl矩形看起来不一样?

  6. 6

    为什么比赛认为这些武器不一样?

  7. 7

    与这些Ubuntu apt-get命令等效的Linux yum命令

  8. 8

    为什么这些不一样?为什么在 C# 中`type.GetType() is Test` 不是真的?

  9. 9

    :not()选择器在Safari和Chrome / Firefox之间表现不一样

  10. 10

    在Windows Bash的Git中,如何安装“ get-apt”和“ sudo”以及所有这些基本命令?

  11. 11

    为什么echo *表现得像ls而printf *表现得不一样?

  12. 12

    ubuntu 13.10 amd 12.04 LTS和有什么不一样???和

  13. 13

    ubuntu 13.10 amd 12.04 LTS和有什么不一样???和

  14. 14

    with和env和有什么不一样

  15. 15

    “ |”和有什么不一样 和“或”?

  16. 16

    :和true和有什么不一样?

  17. 17

    "this" 和 "::" 和有什么不一样?

  18. 18

    这些都一样吗?

  19. 19

    线程和有什么不一样

  20. 20

    列表理解和for循环的结果不一样

  21. 21

    SqlLite 和 MariaDb SELECT 的结果不一样

  22. 22

    PHP 和 WebView - Cookie 不一样

  23. 23

    过渡时间不一样

  24. 24

    周末不一样的内容

  25. 25

    ls和有什么不一样?grep * e *和ls | grep e

  26. 26

    “ ||”和有什么不一样 和“或”在PHP中?

  27. 27

    javascript Promise和q promise和有什么不一样

  28. 28

    phpinfo()和有什么不一样?和PHP -i?

  29. 29

    &!和有什么不一样?和&| 在zsh中?

热门标签

归档