install tkPDFViewer

  • mit sudo pip3 install tkPDFViewer

    ....wird ein Modul installiert, was aber nach kurzer Ladezeit mit Fehlermeldung beendet wird.

    verwendet hier Raspi4 mit Python 3.7

    wer kennt eine Abhilfe?

    folgendes wollte ich ausprobieren


    # pip3 install tkPDFViewer

    import os

    from tkinter import *

    from tkPDFViewer import tkPDFViewer as pdf

    root = Tk()

    root.geometry("550x750")

    v1=pdf.ShowPdf()

    v2=v1.pdf_view(root,

    pdf_location=r"raspi4Guide.pdf",

    width=50, height=100)

    v2.pack()

    root.mainloop()

    Einmal editiert, zuletzt von hkrf (30. Oktober 2021 um 11:50)

  • Hallo,

    mit Fehlermeldung beendet wird.

    bitte poste die vollständige Fehlermeldung.

    Verwende keine *-Importe, damit holst du dir alle Namen aus 'tkinter' und die die darin importiert werden in deinen Namensraum. Das kann zu Namenskollisionen und ganz unübersichtlichen Codes führen. Auch wenn man das in verschiedenen Tutorials immer wieder sieht.

    Wenn die PDF-Datei nicht im gleichen Verzeichnis wie die Python-Datei liegt, dann ist deine Pfadangabe nicht richtig. Allgemein solltest du immer absolute Pfade verwenden, zum Beispiel /home/pi/Documents/raspi4Guide.pdf. Damit wird immer am richtigen Pfad nach der Datei gesucht, egal wohin du dein Python-Programm verschiebst.

    Dann hast du noch 'os' importiert, das du gar nicht nutzt. Aber auch wenn du es nutzen willst, nutze es nicht ^^ Für Pfade gibt es 'pathlib' und wenn du externe Programme ausführen willst, dann gibt es dafür 'subprocess'.

    Ich gehe mal davon aus, dass das nur ein Test-Programm ist und du bei deinem richtigen Programm Funktionen nutzt, vernünftige, sprechende Namen wählst und je nach dem was das GUI alles können muss, auch Klassen.

    Grüße

    Dennis

    🎧 With the music execution and the talk of revolution, it bleeds in me and it goes 🎧

  • Vielen Dank für den Tip.

    Das Beispielprogramm ist nicht so wichtig, weil bereits das downloaden

    mit.: sudo pip3 install tkPDFViewer

    den Fehler erzeugt.

    pi@raspberrypi:~ $ sudo pip3 install tkPDFViewer

    Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple

    Collecting tkPDFViewer

    Using cached https://files.pythonhosted.org/packages/58/b1…y3-none-any.whl

    Collecting PyMuPDF (from tkPDFViewer)

    Using cached https://files.pythonhosted.org/packages/62/cf…F-1.19.1.tar.gz

    Building wheels for collected packages: PyMuPDF

    Running setup.py bdist_wheel for PyMuPDF ... error

    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xrsfb0b2/PyMuPDF/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-vfsahhd5 --python-tag cp37:

    running bdist_wheel

    running build

    running build_py

    creating build

    creating build/lib.linux-armv7l-3.7

    creating build/lib.linux-armv7l-3.7/fitz

    copying fitz/__init__.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/fitz.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/utils.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/__main__.py -> build/lib.linux-armv7l-3.7/fitz

    running build_ext

    building 'fitz._fitz' extension

    creating build/temp.linux-armv7l-3.7

    creating build/temp.linux-armv7l-3.7/fitz

    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/mupdf -I/usr/local/include/mupdf -Imupdf/thirdparty/freetype/include -I/usr/include/freetype2 -I/usr/include/python3.7m -c fitz/fitz_wrap.c -o build/temp.linux-armv7l-3.7/fitz/fitz_wrap.o

    fitz/fitz_wrap.c:2755:10: fatal error: fitz.h: Datei oder Verzeichnis nicht gefunden

    #include <fitz.h>

    ^~~~~~~~

    compilation terminated.

    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------

    Failed building wheel for PyMuPDF

    Running setup.py clean for PyMuPDF

    Failed to build PyMuPDF

    Installing collected packages: PyMuPDF, tkPDFViewer

    Running setup.py install for PyMuPDF ... error

    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xrsfb0b2/PyMuPDF/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-kn3z2f7r/install-record.txt --single-version-externally-managed --compile:

    running install

    running build

    running build_py

    creating build

    creating build/lib.linux-armv7l-3.7

    creating build/lib.linux-armv7l-3.7/fitz

    copying fitz/__init__.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/fitz.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/utils.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/__main__.py -> build/lib.linux-armv7l-3.7/fitz

    running build_ext

    building 'fitz._fitz' extension

    creating build/temp.linux-armv7l-3.7

    creating build/temp.linux-armv7l-3.7/fitz

    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/mupdf -I/usr/local/include/mupdf -Imupdf/thirdparty/freetype/include -I/usr/include/freetype2 -I/usr/include/python3.7m -c fitz/fitz_wrap.c -o build/temp.linux-armv7l-3.7/fitz/fitz_wrap.o

    fitz/fitz_wrap.c:2755:10: fatal error: fitz.h: Datei oder Verzeichnis nicht gefunden

    #include <fitz.h>

    ^~~~~~~~

    compilation terminated.

    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------

    Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xrsfb0b2/PyMuPDF/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-kn3z2f7r/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-xrsfb0b2/PyMuPDF/

    pi@raspberrypi:~ $

  • Grüße,

    Wenn ich jetzt die Fehlermeldungen error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1 Google, bekomme ich folgendes:

    sudo apt-get install gcc

    sudo apt-get install gcc libffi-dev libssl-dev python3-dev

    Und bei failed with error code 1 in /tmp/pip-install-xrsfb0b2/PyMuPDF/ kommt z.B.:

    GitHub PyMuPDF issues

    Alle Angaben ohne Gewähr

    Mach vorher ein Backup, wenn nötig.

    Ansonsten Google die Fehlermeldungen und probiere den Kram aus und wie gesagt mach ein Backup wenn nötig.

  • Beitrag von hkrf (31. Oktober 2021 um 10:57)

    Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar.
  • beide Kommandos ausgeführt (war erfolgreich )

    sudo apt-get install gcc[/tt]

    sudo apt-get install gcc libffi-dev libssl-dev python3-dev[/tt]

    dann nochmals eingegeben:

    pi@raspberrypi:~/Desktop $ pip3 install tkPDFViewer

    Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple

    Collecting tkPDFViewer

    Using cached https://files.pythonhosted.org/packages/58/b1…y3-none-any.whl

    Collecting PyMuPDF (from tkPDFViewer)

    Downloading https://files.pythonhosted.org/packages/62/cf…F-1.19.1.tar.gz (2.3MB)

    100% |████████████████████████████████| 2.3MB 194kB/s

    Building wheels for collected packages: PyMuPDF

    Running setup.py bdist_wheel for PyMuPDF ... error

    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-1kq51ehq/PyMuPDF/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-izxgwaie --python-tag cp37:

    running bdist_wheel

    running build

    running build_py

    creating build

    creating build/lib.linux-armv7l-3.7

    creating build/lib.linux-armv7l-3.7/fitz

    copying fitz/__init__.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/fitz.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/utils.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/__main__.py -> build/lib.linux-armv7l-3.7/fitz

    running build_ext

    building 'fitz._fitz' extension

    creating build/temp.linux-armv7l-3.7

    creating build/temp.linux-armv7l-3.7/fitz

    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/mupdf -I/usr/local/include/mupdf -Imupdf/thirdparty/freetype/include -I/usr/include/freetype2 -I/usr/include/python3.7m -c fitz/fitz_wrap.c -o build/temp.linux-armv7l-3.7/fitz/fitz_wrap.o

    fitz/fitz_wrap.c:2755:10: fatal error: fitz.h: Datei oder Verzeichnis nicht gefunden

    #include <fitz.h>

    ^~~~~~~~

    compilation terminated.

    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------

    Failed building wheel for PyMuPDF

    Running setup.py clean for PyMuPDF

    Failed to build PyMuPDF

    Installing collected packages: PyMuPDF, tkPDFViewer

    Running setup.py install for PyMuPDF ... error

    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-1kq51ehq/PyMuPDF/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-2s76h5cw/install-record.txt --single-version-externally-managed --compile --user --prefix=:

    running install

    running build

    running build_py

    creating build

    creating build/lib.linux-armv7l-3.7

    creating build/lib.linux-armv7l-3.7/fitz

    copying fitz/__init__.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/fitz.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/utils.py -> build/lib.linux-armv7l-3.7/fitz

    copying fitz/__main__.py -> build/lib.linux-armv7l-3.7/fitz

    running build_ext

    building 'fitz._fitz' extension

    creating build/temp.linux-armv7l-3.7

    creating build/temp.linux-armv7l-3.7/fitz

    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/mupdf -I/usr/local/include/mupdf -Imupdf/thirdparty/freetype/include -I/usr/include/freetype2 -I/usr/include/python3.7m -c fitz/fitz_wrap.c -o build/temp.linux-armv7l-3.7/fitz/fitz_wrap.o

    fitz/fitz_wrap.c:2755:10: fatal error: fitz.h: Datei oder Verzeichnis nicht gefunden

    #include <fitz.h>

    ^~~~~~~~

    compilation terminated.

    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------

    Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-1kq51ehq/PyMuPDF/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-2s76h5cw/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-1kq51ehq/PyMuPDF/

    pi@raspberrypi:~/Desktop $

    weiter bin ich nicht gekommen...

    vielen Dank für bisherige Tipps

  • Was mich erstaunt ist, dass am Windows10 Rechner mit "Thonny "( eine Pythonprogrammieroberfläche) dasselbe Programm anstandslos funktioniert.

    Am Raspberry scheint noch was im "tkinter" nicht zu passen.

  • https://github.com/pymupdf/PyMuPD…untu_pymupdf.sh


    Ich baue das Paket gerade, aber so wirklich Spaß macht das nicht.

    Erst mal braucht man die ganzen Abhängigkeiten zum Kompilieren.

    Das Paket PyMuPDF ist ein swig wrapper für MuPDF.

    Um das Paket PyMuPDF kompilieren zu können, braucht man MuPDF, dass man vorher auch kompilieren muss.

    Also ich habe schon viel Mist gesehen, aber bei dem Paket hat man sich besonders Mühe gegeben viel Mist zu erzeugen.

    ... der baut immer noch und ich hab vor einer Stunde angefangen.


    Fertig: https://archive.server101.icu/python/3.7/whe…inux_armv7l.whl

    Ich weiß aber nicht, ob das Paket bei dir funktionieren wird.

    Möglicherweise fehlen dir Abhängigkeiten.

    Einmal editiert, zuletzt von RestlessMud46765 (1. November 2021 um 18:42)

  • Ich überlege, ob andere pdf-Reader unter Python geeignerter sind, als diese Variante.

    Spätere Raspberryupdates können vielleicht die komplierten Pakete wieder modifizieren, so dass danach nichts mehr geht. oder..?

    Vielen Dank für die bisherigen Hilfestellungen

Jetzt mitmachen!

Du hast noch kein Benutzerkonto auf unserer Seite? Registriere dich kostenlos und nimm an unserer Community teil!