0

I've been trying to use py2exe on a completed code, but something is not going right with my py2exe installation. I am getting the error below:

I am running below version of Python along with py2exe

>>>>>Installed Pythons found by py Launcher for Windows
 -3.7-64 *

>>>>>Collecting py2exe
Downloading https://files.pythonhosted.org/packages/6a/16/19bd8b59db4a61ff003aee258efd86a0aca050718435b1f54592ac870235/py2exe-0.9.2.2-py33.py34-none-any.whl (270kB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 276kB 819kB/s
Installing collected packages: py2exe
Successfully installed py2exe-0.9.2.2

Please Help

from distutils.core import setup
import py2exe
import sip
setup(options={'py2exe':{'bundle_files': 1, 'compressed': True}}, 
    windows=['INCSrc.py'], zipfile = None)

Error: Importing py2exe fails

Traceback (most recent call last):
  File "C:\Users\Desktop\Python Projects\Final\setup.py", line 2, in <module>
    import py2exe
ModuleNotFoundError: No module named 'py2exe'
Jack Fleeting
  • 24,385
  • 6
  • 23
  • 45
Gary
  • 99
  • 1
  • 7
  • Make sure the you're installing `py2exe` to the same python installation you're running this from – clubby789 Aug 07 '19 at 09:58
  • @JammyDodger how can I change the installation path .. It seems py2exe is inside c:\users\appdata\local\programs\python\python37-32\lib\site-packages (0.9.2.2) and my code is in C:\Users\Desktop\Python Projects\Final\setup.py? – Gary Aug 07 '19 at 10:02
  • @Gary Just run "Command Prompt (cmd)" as Administrator and then try to install "py2exe" and then import module. – Urvi Soni Aug 07 '19 at 10:04
  • @UrviSoni I just tried running as Admin but no luck Requirement already satisfied: py2exe in c:\users\gsingh\appdata\local\programs\python\python37-32\lib\site-packages (0.9.2.2) import py2exe ModuleNotFoundError: No module named 'py2exe' – Gary Aug 07 '19 at 10:15
  • @Gary just check this You will find your solution:- https://stackoverflow.com/questions/1271337/importerror-no-module-named-py2exe – Urvi Soni Aug 07 '19 at 10:19
  • @UrviSoni I checked this one but seems its for Python 2.X and I am running 3.X – Gary Aug 07 '19 at 10:29

1 Answers1

0

Open your CMD prompt command and try:

pip install py2exe

or in Conda prompt:

conda install py2exe

To check all installed modules:

pip freeze

If you're using Pycharm you can Go File -> Settings -> Project: PycharmProjects -> Project Interpreter

And install manually all modules you need.

Good luck!

Izalion
  • 708
  • 4
  • 11
  • I tried these but no luck.. Note: I a, using Sublime Text Editor and Still getting the same error... It's not working – Gary Aug 11 '19 at 09:05