How to create a standalone exe using python 3.4 - exe

I have created an exe file using cx_freeze (python 3.4).
Along with the exe there is a library.zip,python34.dll and some .pyd file with it.How can i create a standalone exe so that it can be run on other systems where python is not installed.
A single exe file is all i want.Can this be achieved...??
This question was asked previously as well but i didnt find any suitable solutions in it.Help please.
Thanks

At first .pyd files are python native extensions written in either C or C++ for windows target platform. Next in order to get exe built you will going to need to have pyinstaller package installed (http://www.pyinstaller.org/). You can install it using either "pip install pyinstaller", "easy_install pyinstaller" or just specify it as a dependency within REQUIREMENTS.TXT or SETUP.PY of yours. But this package depends on pywin32 package which can only be installed either manually or with easy_install. It doen't support pip because the only bundle that is available is - exe file format. easy_install handles it though.

Related

How do you downgrade pyinstaller using pip?

I am currently developing a program in python and I am converting this into a .exe file so I can share it. However, there have been many virus alerts and I have not been able to do this. I am using PyInstaller to convert my files. I believe this issue may be coming from the actual conversion itself. I have heard that the new version of PyInstaller is generating these issues. Many people have said to downgrade PyInstaller to an earlier version to avoid this issue.
So my question is: 'How do you downgrade a python module such as PyInstaller?'
And should I try using other modules to convert my files or should I stick to PyInstaller?
Thanks!
pip install --upgrade (package)==(version)
Add this command instead of (package) write your package which here you want pyinstaller and then in (version) add which version you want to of the pyinstaller.
MAKE SURE TO REMOVE THE BRACES ().
Have you tried pip install pyinstaller==3.6? In this case, I have chosen the version 3.6. You can choose other versions also.

How to run GTK3 Python3 script outside of MSYS2 in Windows

How can I make my GTK3+ Python script work outside of Msys2's own Python interpreter, into my own venv (virtual environment) Python3 interpreter? I want to prepare my Python 3 script for distribution to other computers, but without Msys2.
I'm using Windows 10.
I've successfully followed the instructions on GTK's website, to download GTK3+ and the Python bindings, in Windows.
I've installed GTK3+ and the Python bindings using MSYS2. My script runs successfully within MSYS2's Python3 interpreter in C:\msys64\mingw64\bin. However, I want to run my Python script outside of MSYS2, with a separate Python 3 interpreter (venv) - not the one in MSYS2.
From my research, it seems that I need to copy the GTK3 .dll files and icons from
C:\msys64\mingw64\bin
and C:\msys64\mingw64\share
to the Python3 interpreter path that I want, with my script files in there too.
But when I attempt to run my script in the virtual environment, I get:
builtins.ImportError: cannot import name '_gi' from 'gi'
Any ideas? Thanks.
I don't know if that is possible.
But if the final intent is to distribute your app, then you should install PyInstaller inside MSYS2 and generate an executable there. Then you'll be able to distribute and execute your app on any Windows machine.
It will only be possible to run your program using the MSYS2 Python interpreter and with all of the required libraries. You can't just copy files and then run them with the Windows Python interpreter that was built using MSVC.
PyInstaller is a good solution to package an app with the interpreter and all of the libraries. The issue you mentioned about getting errors about no module named '_struct' has been fixed.

Installing Python silently

I have my code written in python 3.6.5. I am trying make this an installable package (something like install shield) and wanted to bundle python software also along with this installshield. OS is Windows
Will python work by unzipping the installation directory and then setting path variable?
When I use /quiet for silent installation of python, I could not change the path of installation directory to my choice, say in my case C:\test(even after setting TargetDir=C:\test). Where am I going wrong?
If there any other approach to bundle installation of python along with installation package can someone let me know?
Why not use Pyinstaller? If python is set to path you can run from CMD pip install pyinstaller. Then you can create a standalone exe that will include the python packages to run. Hold shift and open a CMD where your script is and then run a command similar to this
pyinstaller --noconsole --icon=data.ico --version-file=Version.txt -F LineQuery.py
The -F is the standalone package. Be aware though that you need to copy the DLLs from microsoft runtime visual c++ 2015 into the python DLL folder usually located at C:\Users\"user"\AppData\Local\Programs\Python\Python36\DLLs. That is if you package it on windows 10. Otherwise you'll have issues with your program running on earlier versions of windows.
The standalone package will be slow at startup. You can package it into a folder that will be faster. Just remove the -F

How to include the Scrapy library in the Python runtime path

Python beginner here. I downloaded and installed latest version of Python on my Windows 7. I also downloaded the zip file for Scrapy. Now is it just a matter of putting the 'scrapy' folder in the 'Python' installation directory?
How will Python pick up Scrapy? I come from Java background, and am used to putting the jar file under the 'lib' folder. Is it something similar
Did you read the installation instructions?
And if you read the docs you would see that Scrapy works with Python 2.7 -- support for 3.x is work in progress.
If you install Scrapy the default way with pip install scrapy you would not need to care about the Path and the dependencies would be all installed too (something similar to Maven or Gradle but not exactly that).

Error installing Pygame / Python 3.4.1

I'm trying to install Pygame and it returns me the following error "Python version 3.4 required which was not found in the registry". However I already have the Python 3.4.1 installed on my system. Does anyone know how to solve that problem?
I've been using Windows 8.1
Thanks in advance.
Are you using a 64-bit operating system? Try using the 32-bit installer.
Tips I can provide:
Add Python to your Path file in the Advanced settings of your Environmental Variables (just search for it in the control panel)
Something may have gone wrong with the download of Python, so re-install it. Also don't download the 64-bit version, just download the 32-bit version from the main pygame website
Once that's sorted out, transfer the entire Pygame file to the site packages in the Python directory and open up the pygame file and go to this directory in command prompt. Finally, run the Pygame setup from the command prompt which should be something like:
python setup.py
But this will only work if the pygame setup file is called setup.py (it's been a while since I downloaded it), you added Python to the Path file and you're currently in the correct directory in command prompt.
To test if it worked try importing pygame and see if you got an error or not.

Resources