Задать вопрос
qwertiss
@qwertiss

Проблема с компиляцией .pyd в Nuitka: «SyntaxError: invalid or missing encoding declaration»?

Я пытаюсь скомпилировать .pyd помощью nuitka 2.6.4.
.pyd скопилил через cython

python setup.py build_ext --inplace

from setuptools import setup
from Cython.Build import cythonize

setup(
    ext_modules=cythonize("main.py", compiler_directives={"language_level": "3"})
)


Сначала использовал Python 3.9.1.
python3.9 -m nuitka --standalone --windows-console-mode=disable --enable-plugin=tk-inter main.cp39-win_amd64.pyd


Вывод получился таким
Nuitka-Options: Used command line options: --standalone --show-scons --windows-console-mode=disable
Nuitka-Options: --enable-plugin=tk-inter main.cp39-win_amd64.pyd
Nuitka: Starting Python compilation with Nuitka '2.6.4' on Python (flavor Unknown), '3.9' commercial grade 'not
Nuitka: installed'.
SyntaxError: invalid or missing encoding declaration for 'main.cp39-win_amd64.pyd'

Nuitka is very syntax compatible with standard Python. It is currently running
with Python version '3.9', you might want to specify more clearly with the use
of the precise Python interpreter binary and '-m nuitka', e.g. use this
'python3.13 -m nuitka' option, if that's not the one the program expects.


Подумал, ладно, кодировку не указал.

# -*- coding: utf-8 -*-
set PYTHONIOENCODING=utf-8


Всё равно не помогло.
Попробовал поставить Python3.13, 3.10.
Всё та же ситуация.

Может я что не правильно делаю и nuitka вообще не работает .pyd? Или я упускаю что-то. Помогите пожалуйста.
  • Вопрос задан
  • 42 просмотра
Подписаться 1 Средний Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы