0
I need to compile the script in python to make it . exe, but only with the pure Python kernel, which does not have most of the libraries I used to develop. The kernel I use for development, is Anaconda - or Conda. How do I compile code using the Anaconda kernel instead of the pure Python kernel?
Edit: The problem is the kernel that cx_freeze is using to compile (currently uses pure python), I need it to be the Anaconda kernel, because I need libraries like Scipy, Mysql Connector, etc...
Oops! Sure, I know this question, but my problem is another. It is not the compilation itself, but the kernel that it uses to compile
– Matheus
Python is not compiled for EXE, it is built into exe, but libs remain as pyd (I think that was the extension) and if there are any dependencies. dlls and others . exe will have to manually copy to your exe folder generated from the folder
Lib\site-packages\{pacote}
, copy only the contents.– Guilherme Nascimento
I get it. In fact they get the extension .pyc. I managed to do this 'conversion', only with the normal python kernel, which does not have the Scipy library for example, when I run the EXE file (which was generated with cx_freeze), a Traceback appears (from the Scipy library)And the application closes soon. I believe that if I 'convert' with the Conda kernel, the application will work properly, only I do not know how to switch to this kernel.
– Matheus
As I said Matheus, you have to copy the packages from the necessary site-Packages lib folder, aside from depending on the version of python you used, the problem with Python is that there is always some lack of backward compatibility for these cx_freeze and pyinstaller, so much that I kind of gave up trying to compile for
.exe
a large application I have and I switched to C++, of course this is not a solution, I’m just commenting on the difficulty I had.– Guilherme Nascimento
There is a mistake in your question, anconda is not a "kernel", anaconda is a python distribution, and Conda is a package manager/envs. You can, yes pack the whole anaconda distro in an exe.
– Sidon
Another mistake is to think that the packages of the anaconda distribution are exclusive to her, on the contrary, you can install 'Scipy, Mysql Connector, etc...' in what you call "pure python kernel", you can install everything you have in anaconda without using it.
– Sidon
Learn more about virtualenv in anaconda in that reply, and in that.
– Sidon