In the installation i have seen a different way to install a python package
generally we use pip
I have installed using pip install pymupdf and it got installed
>> import fitz
>> print(fitz.__doc__)
PyMuPDF 1.16.3: Python bindings for the MuPDF 1.16.0 library.
Version date: 2019-10-01 09:01:06.
Built for Python 3.7 on linux (64-bit).
But then when i try
>> from fitz.__main__ import main as fitz_command
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-925f641fec03> in <module>
1 import fitz
----> 2 from fitz.__main__ import main as fitz_command
ModuleNotFoundError: No module named 'fitz.__main__'
The following are the directory contents of fitz
$ cd /lib/python3.7/site-packages/fitz
$ ls
_fitz.cpython-37m-x86_64-linux-gnu.so fitz.py __init__.py __pycache__ utils.py
I am using archlinux. I want to use the
python -m fitz join -o output.pdf file1.pdf file2.pdf file3.pdf
but it says
/usr/bin/python: No module named fitz.__main__; 'fitz' is a package and cannot be directly executed
SOLVED IT
I got the package installed using aur (https://aur.archlinux.org/packages/python-pymupdf/)
i removed the pip installation
pip uninstall pymupdf
and then installed it using the https://aur.archlinux.org/packages/python-pymupdf/
yay -S python-pymupdf #in archlinux only)
Now the command
python -m fitz join -o output.pdf file1.pdf file2.pdf file3.pdf
works
Most helpful comment
SOLVED IT
I got the package installed using aur (https://aur.archlinux.org/packages/python-pymupdf/)
i removed the pip installation
pip uninstall pymupdfand then installed it using the
https://aur.archlinux.org/packages/python-pymupdf/Now the command
works