Is there a py2exe version that's compatible with python 3.5? - py2exe

I am trying to compile my python 3.5 file with the latest py2exe version 0.9.2.2 with the following command:
py -3.5 -m py2exe.build_exe myscript.py
But it reports this:
"run-py3.5-win-amd64.exe" file is not found in the
...lib\site-packages\py2exe\ folder.
Does this mean that py2exe 0.9.2.2 is only compatible up to python 3.4?

Unfortunately as of November 2016 there is still no Python 3.5 support in sight for py2exe. However, I've had great success using cx_Freeze 5.0 with Python 3.5 and since both projects use a very similar configuration I've migrated away from py2exe to cx_Freeze without much work. Binary Wheels of cx_Freeze 5.0 for Python 3.5 are now available officially on PyPi: https://pypi.python.org/pypi/cx_Freeze

Install pyinstaller through Command Prompt (Microsoft Windows) :
search cmd on windows to open Command Prompt with black screen
type and enter: pip install pyinstaller
Again at Command Prompt type and enter: cd c:\....(the Folder where your file example.py is located)
Finally type and enter: pyinstaller --onefile example.py
Now after some minutes your example.exe is ready

There are significant changes in Python 3.5 regarding the MSVCR dll dependency. py2exe 0.9.2.2 supports Python 3.3 and 3.4
Article describing these changes - BUILDING EXTENSIONS FOR PYTHON 3.5

I came here looking for a 3.5 exe generator. I've found that using "pyinstaller" version 3.2 works perfectly with python 35. I found the easiest way to use it is from the command window when on Windows. To make things a little easier you can create a command window from the directory your scripts are stored. Here's how:
From the directory your scripts are saved you can launch a command window by holding 'Alt' + 'Shift' and clicking on the window. In the drop down menu you will see "Open Command Window Here". In that command window you will write 'pyinstaller --onefile script.py' where "script.py" is the name of the script you want to generate the .exe for. I hope this helps someone else as much as it helped me.

Py2Exe just released Py2Exe for Python 3!
To install on windows do this:
cd C:\Python34\Scripts
Then run:
pip install py2exe
And your done you can now run the normal commands, and if your having trouble here are the docs.

I note that the original question was asked just shy of 4 years ago. Visiting https://pypi.org/project/py2exe/
the version offered is still at 0.9.2.2
Using the command pip install py2exe and checking the py2exe directory created on my system, I only see options for Python 3.3 and 3.4 installed.
Given that the last time py2exe was updated was in 2014, my guess is that it is no longer being developed so folks wanting to create executables using versions of Python more recent than 3.4 should look elsewhere for a solution.

**
#I use pyinstaller
#pip install pyinstaller
#command line:
#pyinstaller --onedir --onefile --name=what you call it --console myscript.py
#pyinstaller --onedir --onefile --name=what you call it --windowed myscript.py
#pyinstaller -h help file
#pyinstaller -d -f -n=file name -c or -w myscript.py
**

There is py2exe for python versions that can be downloaded at https://pypi.python.org/pypi/py2exe/0.9.2.0#downloads

Related

Having difficulty running pygame 2.7

Every time I try to run Pygame 2.7 version I get this prompt:
Windows cant open this file:
File name: pygame-1.9.2b1-cp27-cp27m-win_amd 64.whl
To open this file Windows needs to know what program you want to use to open it.
Windows can go online to look it up automatically, or you can manually select from a list of programs that are installed on your computer.
What do you want to do?
Use the Web service to find the correct program
Select a program from a list of installed programs
How can this be solved?
I've tried many Youtube videos.
That .whl file that you mention needs to be installed with a command-line tool called pip that comes with python. Assuming you are starting from scratch, here is what you need to do to install python and pygame. Also, as a minor sidenote, you are actually installing pygame 1.9.2 on python 2.7. Assuming you are interested in that particular version of python and pygame, here are the steps you need to follow.
To install python 2.7, you need to first go to the Python Software Foundation's website here. Go to the download section by clicking on the latest link for python 2.7.12. Scroll down and download either the x86 or x86-64 MSI installer (depending if you are on a 32bit or 64bit platform respectively).
Run the MSI installer. Most of the default options should be fine, nothing too tricky here.
After you run the installer, you need to add python to the PATH environment variable so that windows actually knows where python is on your computer. To do this, you need to find the Advanced System Settings section in your control panel (how to exactly get there varies depending on what Windows version you are on).
Once you are there, click the Environmental Variables... button. Under System Variables, we need to edit the value of the Path variable to include C:\Python27\ at the end of it. If all of the path variable stuff is on one line, you need to add a semicolon to separate it from the other paths in the list.
Congrats, now python 2.7 should be installed at this point! To test it out, open up the command prompt and type python. It should open up the interpreter in the command line and should be working.
Assuming it is working, exit out of the python interpreter. In the command prompt, type python -m pip install pygame. This should automatically install pygame for you. If you really want to use your wheel file, cd to the directory where it is installed and type python -m pip install pygame-1.9.2b1-cp27-cp27m-win_amd 64.whl.
Once that is done, you should have both python and pygame installed! Test it out in your IDE of choice (I personally use Geany) and start writing some code! Let me know if these instructions are clear enough.

Vim for Windows: Python doesn't load properly / “crashes”

I've been struggling for 2 days to install some plugins which use python on Vim (Windows). Even with a stock vimrc.
Using the official vim 7.4 binary (x86)
I've checked that it comes with +python/dyn and +python3/dyn
I've installed Python 2.7.10 x86, and appended python's path in my Path environment.
:echo has('python') prints 1 as expected.
Yet: when I type :python print 'test', vim quits, just as if I've typed :q
:python mum tell me, why does windows exists?, it quits as well. Wondering why... Not a print issue at least.
Using tuxproject's nighty builds of vim 7.4.826 (x86)
It does come with +python/dyn and +python3/dyn. Also:
Used libraries: Perl 5.22.1, Python 2.7.10, Python 3.4.3, Ruby 2.2.3, Lua 5.3.0, Tcl 8.6.4, libXpm.
Great! That's the verison I've downloaded (2.7.10) ! Wait...
:echo has('python') prints 1 as expected.
But, "merry christmas!" says vim.
Sorry, this command is disabled, the Python's site module could not be loaded. Windows isn't good enough. Oh, and merry christmas!
Using tuxproject's nighty builds of vim 7.4.826 (x64)
I tried to use x64's python binary, taking care of removing the x86 version from my Path variable. Same issue as above.
Using Kaoriya's vim 7.4.something (x64) and Veegee's vim 7.4.803
Same issue as above.
What about compiling vim ?
Windows.
I'm not that lazy, well, yes I am... but I'll try to compile it if there isn't any other workaround. I don't really want to compile it if it won't solve anything. If only I could at least understand why these issues happen...
All right, I managed to solve the issue.
For those who may be interested, the intended python version was Python 2.7.9 and not 2.7.10. Installing Python 2.7.9 x86 (and x64) fixed everything for the corresponding vim version.
First of all, need to check for the python version compiled into the vim. One of the way is to edit the gvim executable (e.g. for window it's gvim.exe), and look for "python\d*.dll\c" as mentioned inside the vim manual. Nonetheless, when you run :echo has('python3') || has ('python'), it may give you the hint that vim cannot find and load python27.dll or python32.dll, so you can guess the python get compiled with vim in this way as well.
Once you have identified the python version needed, and if your python is installed on another location, then you can specify the pythonthreedll location to let vim to find it.
:set pythonthreedll=D:\installed\python\python35.dll
check again with following:
:echo has('python3')
I have this problem too but I didn't have to install previous versions.
All I do to solve this is just set PYTHONHOME=C:\Users\MYUSERNAME\Anaconda2 in my system environment variables!
You may have to adjust the location if you did not use Anaconda as a python installer.
Note: I use python 2.7.11 and 3.5 (Both of them are installed via Anaconda 64-bit)
PS. Please ensure that PYTHONHOME is typed correctly, no underscores. And it should point to the location of Python 2 only. Don't point to Python 3 folder.
PPS. It turns out that if you set PYTHONHOME, your working python3 command on the terminal will crash, so I do not suggest this anymore.

how to compile libnet for python 2.7 on windows

I have python 2.7 on windows xp, I need libnet but it's not supported for python 2.7 .
I tried to compile it using cygwin, as I don't use python on cygwin gnu and I could not compile it using mingw32, is there any way to install mingw32 in the gnu of cygwin. I read some about VC compile but I totally didn't understand. I need it for w3af framework[which need scapy [which need libnet - and python 2.7]]
trying to make w3af framework run on windows [because it is not supported anymore on win]
You can try this:
Install Python 2.5 and dnet module
https://code.google.com/p/libdnet/downloads/detail?name=dnet-1.12.win32-py2.5.exe&can=2&q=
You can do this on other machine.
Modify filename "dnet-1.12-py2.5.egg-info" to "dnet-1.12-py2.7.egg-info" located at c:\python25\lib\site-packages\
Open binary file of dnet: dnet.pyd located at c:\python25\lib\site-packages\ by Ultraedit or associated tool(I use winhex)
Find the string "python2.5.dll", for my experience, it addressed 0x00019cD1, change hex value from "35" to "37", the string will become "python2.7.dll"
copy that modified file to same place for python2.7 folder (c:\python27\lib\site-packages)
It works on my machine: Windows8, Python2.7.3
I've created a GNU makefile to build it for MSVC. It's here
Tested with Python 2.7 only.

How do I build cx_freeze from source on Windows?

I tried to install cx_freeze on my computer (windows) with an MSI, but the installation kept failing saying something like "one or more needed files could not be found." Because installing from a prebuilt binary wasn't an option, I decided to build cx_freeze from source.
I downloaded the .tar.bz and extracted until I got to the actual folder containing the setup.py. I cded into the directory, and ran the command
python setup.py install
A cmd windows came up and printed out a lot of text along the lines of "adding base module named...",then printed out
running install
running build
running build_py
However, the install then failed with the error
error: package directory 'cx_freeze' does not exist
I have no idea how to solve this. If someone could give me working instructions on how to install cx_freeze that would be great
BTW, I'm on python 3.3
After struggling around for 1 and a half hour I found the solution!
I followed these steps to compile CX_Freeze from source for Python 3.3:
install visual studio 2010 c++ (only 2010 works!)
Download the latest version of CX_Freeze from BitBucket. You need this one, the version on the main page of CX_Freeze misses one file! https://bitbucket.org/anthony_tuininga/cx_freeze
Extract the file
Launch cmd and cd to the directory of the extracted folder. (This will avoid your problem)
(optional: path to python.exe) setup.py install
Done!
During this I faced one major issue. There where some problems with mt.exe and it failed with exit status 31.
The solution is to go to you python and edit msvc9compiler.py in Lib/distutils.
Search for the following line:
ld_args.append(‘/MANIFESTFILE:’ + temp_manifest)
replace it by:
ld_args.append(‘/MANIFEST’)
sources which helped me:
http://fuyun.org/2009/12/install-mysql-for-python-on-windows/
http://grokbase.com/t/python/tutor/03be598tkx/how-to-install-new-package#20031115zd5eiqq27cbflktokjw4esr4g4

add tar/gzip to windows command line

As the title says - anyone know of a method to add tar/gzip to the command line in Windows? I've installed Cygwin - but don't know if I have to add something to the PATH env variable to get tar as a cmd option
The method I've used to solve this is to install Cygwin then place the path to the bin directory in the PATH variable.
9 years later (2019), a more modern option is to uncompress the latest Git for Windows (like PortableGit-2.17.0-64-bit.7z.exe).
It comes with 250+ linux command compiled for Windows, including tar and gzip.
No Cygwin needed.
But an even more recent option is the Command Line in Windows 10 version 1803: it includes a native tar and curl, right from your regular CMD.
(not gzip though). See announcement.
C:\Users\vonc>C:\Windows\System32\tar.exe --version
bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp
Nothing to install!
You can install archiver instead of adding command in Windows cmd.exe,
There only 10 step to install and create .tar.gz file:
1. Open: https://www.win-rar.com/download.html or https://www.7-zip.org/download.html
2. Download Winrar Installer.
3. Open Winrar Installer.
4. Click "Agree" on Agreement.
5. Install Winrar.
6. Wait until Winrar fully installed in your computer.
7. Open file you want to compress with .gz
8. Right click the file.
9. Click "Add to Archive", and
10. Done.
But, if you still want to add command in Windows cmd.exe you can use that Cygwin. Tutorial link: https://www.youtube.com/watch?v=Rb8qtbXGA6I
Install UnxUtils - it's a set of GNU utilities ported to Windows, sort of like Cygwin but they also work outside the Cygwin environment.

Resources