48
>>> python -c "import sys; print sys.version"
2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]

>>> pip --version
pip 1.5.5 from C:\Python27\lib\site-packages (python 2.7)

>>> pip install py2exe
<mumble grumble..>
RuntimeError: This package requires Python 3.3 or later

though official py2exe download page says they have exactly what I need:

screenshot

So how to install py2exe over pip?

Bruno Gelb
  • 5,322
  • 8
  • 35
  • 50

5 Answers5

68

It is missing from pypi, if you click on the 0.6.9 link it brings you to the 0.9.2.0 python 3 package, there seems to be no 0.6.9 package available to download.

Try using pip install http://sourceforge.net/projects/py2exe/files/latest/download?source=files

Padraic Cunningham
  • 176,452
  • 29
  • 245
  • 321
  • 2
    Worked for me, I did have to install the Microsoft Visual C++ Compiler for Python 2.7 which it mentioned in the error message I got: error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27 – DavedeKoning Aug 03 '17 at 14:07
  • I got the following exception from this - `SSLError: hostname 'sourceforge.net' doesn't match u'*.sourceforge.net'` – Peter Sep 19 '17 at 12:53
32

There is also a wheel of py2exe available for Python 2.x: py2exe_py2 0.6.9

You can do: pip install py2exe_py2

Pypi link.

Exeleration-G
  • 1,360
  • 16
  • 29
vk1011
  • 7,011
  • 6
  • 26
  • 42
  • 3
    works for me .. seems the better solution than the accepted answer – Peter Parker Feb 27 '17 at 08:50
  • 1
    fails for me, the above cmd produces 'collecting py2exe py2exe-py2' (the underscore becomes hyphen) with the message, Could not find a version that satisfies the requirement py2exe-py2 (from versions: ) No matching distribution found for py2exe-py2 – Matt Warren Mar 23 '17 at 11:17
  • 1
    Works for Python2.7 32 bits for Windows – pupitetris Dec 22 '17 at 18:08
  • For those having issues, make sure you're trying from a 32-bit install of Python. This seemed to be the difference between success or not for me: default environment was choosing 64-bit python and pip and failing to find a compatible version. – tychon Mar 21 '19 at 01:13
  • It worked for me too! Thanks. (After being through a lot of trouble until now with py2exe installation!) *** This should be the answer with the higher upvotes *** (Mine didn't change the situation!). But who says that life is fair? :) – Apostolos Dec 01 '19 at 10:44
5

I'm using Anacona, and I install py2.7 via its environments feature, so previous answers were not helpful to me.

--------------------------- Cannot install ---------------------------  
Python version 2.7 required, which was not found in the registry. 

The following is the command I used, it can install py2exe via command line.

pip install https://nchc.dl.sourceforge.net/project/py2exe/py2exe/0.6.9/py2exe-0.6.9.zip
...
Successfully installed py2exe-0.6.9

Cause py2exe requires Microsoft Visual C++ 9.0, so before installing, you should download and install it, by convenience, via this link

Hope this could be helpful, Thx.

scruel
  • 426
  • 6
  • 14
  • Was getting the same error via the GUI installer, and after installing VC++ 9 for Python via the provided link, this `pip` command worked for me. Thank you! – qJake Feb 25 '20 at 17:59
-1

You may try using pip3. Or if pip3 is not installed or not found, try: python3 -m pip install py2exe.

Source: https://superuser.com/a/942338/315157

There
  • 498
  • 6
  • 18
-2

you can directly download py2exe for python 2.7 from here

Thomas
  • 478
  • 4
  • 14