Python Cod中Weasyprint的Nuitka转换错误

2024-10-01 15:41:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图从Python代码编译可执行文件,该代码使用WeasyPrint进行PDF转换,使用Nuitka但给出了错误。你知道吗

我已经在“C:\MinGW64”下为C编译器安装了MinGW64。你知道吗

python -m nuitka --follow-imports --standalone --mingw64 websense-url-checker.py

运行代码后,它会发出以下警告。你知道吗

Nuitka:WARNING:Use '--plugin-enable=pylint-warnings' for: Understand PyLint/PyDev annotations for warnings.

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Users\[USER-NAME]\DOCUME~1\TEST-
P~1\WEBSEN~1\venv\lib\site-packages\PIL\Image.py:432' may require use of '--incl
ude-plugin-directory' or '--include-plugin-files'.

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Users\[USER-NAME]\DOCUME~1\TEST-
P~1\WEBSEN~1\venv\lib\site-packages\cffi\verifier.py:151' may require use of '--
include-plugin-directory' or '--include-plugin-files'.

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Users\[USER-NAME]\DOCUME~1\TEST-
P~1\WEBSEN~1\venv\lib\site-packages\cx_Freeze\hooks.py:468' may require use of '
--include-plugin-directory' or '--include-plugin-files'.

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Users\[USER-NAME]\DOCUME~1\TEST-
P~1\WEBSEN~1\venv\lib\site-packages\defusedxml\common.py:83' may require use of
'--include-plugin-directory' or '--include-plugin-files'.

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Users\[USER-NAME]\DOCUME~1\TEST-
P~1\WEBSEN~1\venv\lib\site-packages\jinja2\loaders.py:472' may require use of '-
-include-plugin-directory' or '--include-plugin-files'.

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Users\[USER-NAME]\DOCUME~1\TEST-
P~1\WEBSEN~1\venv\lib\site-packages\jinja2\utils.py:142' may require use of '--i
nclude-plugin-directory' or '--include-plugin-files'.

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Users\[USER-NAME]\DOCUME~1\TEST-
P~1\WEBSEN~1\venv\lib\site-packages\jinja2\utils.py:143' may require use of '--i
nclude-plugin-directory' or '--include-plugin-files'.

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Users\[USER-NAME]\DOCUME~1\TEST-
P~1\WEBSEN~1\venv\lib\site-packages\requests\packages.py:7' may require use of '
--include-plugin-directory' or '--include-plugin-files'.

它虽然生成可执行文件,但运行exe时会产生以下结果。你知道吗

websense-url-checker.dist\websense-url-checker.exe

Traceback (most recent call last):
  File "C:\Users\[USER-NAME]\Documents\test-python\websense-url-checker\websense-url-checker.dist\websense-url-checker.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "C:\Users\[USER-NAME]\Documents\test-python\websense-url-checker\websense-url-checker.dist\weasyprint\__init__.py", line 20, in <module weasyprint>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "C:\Users\[USER-NAME]\Documents\test-python\websense-url-checker\websense-url-checker.dist\cssselect2\__init__.py", line 20, in <module cssselect2>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "C:\Users\[USER-NAME]\Documents\test-python\websense-url-checker\websense-url-checker.dist\cssselect2\compiler.py", line 7, in <module cssselect2.compiler>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "C:\Users\[USER-NAME]\Documents\test-python\websense-url-checker\websense-url-checker.dist\tinycss2\__init__.py", line 10, in <module tinycss2>
  File "C:\Users\[USER-NAME]\Documents\test-python\websense-url-checker\websense-url-checker.dist\pathlib.py", line 1206, in read_text
  File "C:\Users\[USER-NAME]\Documents\test-python\websense-url-checker\websense-url-checker.dist\pathlib.py", line 1193, in open
  File "C:\Users\[USER-NAME]\Documents\test-python\websense-url-checker\websense-url-checker.dist\pathlib.py", line 1046, in _opener
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\[USER-NAME]\\Documents\\test-python\\websense-url-checker\\websense-url-checker.dist\\tinycss2\\VERSION'

Tags: nameinpyurllinecheckerloadimportlib

热门问题