Nuitka tries to convert Python to C, but says C compiler not found

Asked 2 years ago, Updated 2 years ago, 99 views

Based on the following article, I would like to use Nuitka to make Python exe.
Make Kivy's GUI app an executable file (exe) that easily runs small and fast in Nuitka (Windows 10)

The following command causes an error:

nuitka --recurse-none main.py

The error details are as follows:

scons:warning:No version of Visual Studio compiler found-C/C++ compilers most likely not set correctly
File "C:\Users\taichi\Anaconda3\lib\site-packages\nuitka\build\SingleExe.scons", line 499, createEnvironment
Error, cannot locate continuous C compiler.You have the following options:

a) If a sustainable Visual Studio version is installed, it will not be located
   automatically, unless you install pywin32 for the Python installation
   below "C:\Users\taichi\Anaconda3".

b) Make it find Visual Studio without registry execute from Start Menu
   the 'Visual Studio Command Prompt' or "vcvarsall.bat". That will add
   Visual Studio to the "PATH". And it will be detected.

c) Install MinGW64 to "C:\MinGW64" or "\MinGW", where then is automatically
   detected or add to PATH before executing Nuitka. But be sure to pick the
   proper variant (32/64 bits, your Python arch is'x86_64'), or else crypto errors
   Will be down.

Normal MinGW will not work!MinGW64 does not mean 64 bits, just better
Windows compatibility.
Cygwin based gcc will not work.
MSYS2 based gcc will not work.

Running with AnacondaPrompt.
The Python version is 3.7

.

The a) message says to install pywin32, so on AnacondaPrompt,

 pip install pywin32

Installed as .The results are as follows:

Requirement already satified: pywin32 inc:\users\taichi\anaconda3\lib\site-packages(223)

The installation appears to have been completed, but there was no change when I tried nuitka again.

b) Visual Studio 2017 is also installed.However, when I searched the Start menu, I couldn't find 'Visual Studio Command Prompt' or 'vcvarsall.bat'.

How can I solve these problems...?

python anaconda

2022-09-30 16:04

1 Answers

The Start menu does not contain the names 'Visual Studio Command Prompt', 'vcvarsall.bat'.
Please refer to this article to launch it to match your Python 32bit/64bit.

'Visual Studio Command Prompt'
How to Enable the 64-bit x64 hosted MSVC Toolset on the Command Line
The description on this page is VS 2019, so VS 2017 might be a little different.
From the Developer Command Prompt shortcut on the following page, the Start menu appears to have Native Tools command prompts starting with x64 or x86, but for some reason the description was not consistent. Tools for Visual Studio 2017 was also installed, so it may be affected.)

"vcvarsall.bat"
Location of developer command files in using Microsoft C++ toolset from the command line This is not on the start menu, so you will need to specify the location of the batch file and run it.

Anaconda Prompt/Virtual environment can also be launched from a command prompt.
Check for launch of Anaconda Prompt

There is also an article that applies that.
Batch file Anaconda Prompt
Run anaconda environment from the batch

Try the combination to see which environment you want to start first and configure the other environment.

It may be a matter of preference, but it may be a matter of preference and the order may be decided.


2022-09-30 16:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.