Jump to content

This is the most frustrating thing I've ever had to do in my life.

 

Why on earth doesn't py2exe work out of the box? I've been doing this for an hour and got nowhere.

 

I don't know how to set up python as an environment variable BECAUSE ITS NOT ****ING WORKING and I when I tried "setup.py py2exe" in CMD I got a big middle finger:

Traceback (most recent call last):
  File "E:\Downloads\py2exe-0.6.9\py2exe-0.6.9\setup.py", line 3, in <module>
    import py2exe
  File "E:\Downloads\py2exe-0.6.9\py2exe-0.6.9\py2exe\__init__.py", line 67, in <module>
    import distutils.dist, distutils.core, distutils.command, build_exe, sys
ImportError: No module named 'build_exe'

 

How do I use py2exe to make a python executable? Please explain in detail, thanks :/

||| Drakon (Desktop Build) |||

|| CPU: 3800X || Cooler: Kraken X63 || Motherboard: B450 Aorus M || Memory: HyperX DDR4-3200MHz 16G ||

|| Storage: 512GB 970 Pro + 500GB 850 EVO + 250GB 850 EVO + 1TB HDD + 2TB HDD || Graphics Card: RX 5700 XT Red Devil || Case: Thermaltake Core V21 || PSU: XFX XTR 750W 80+Gold || 

 

Link to comment
https://linustechtips.com/topic/615542-how-to-make-a-python-executable/
Share on other sites

Link to post
Share on other sites

3 hours ago, Aleksbgbg said:

This is the most frustrating thing I've ever had to do in my life.

 

Why on earth doesn't py2exe work out of the box? I've been doing this for an hour and got nowhere.

 

I don't know how to set up python as an environment variable BECAUSE ITS NOT ****ING WORKING and I when I tried "setup.py py2exe" in CMD I got a big middle finger:


Traceback (most recent call last):
  File "E:\Downloads\py2exe-0.6.9\py2exe-0.6.9\setup.py", line 3, in <module>
    import py2exe
  File "E:\Downloads\py2exe-0.6.9\py2exe-0.6.9\py2exe\__init__.py", line 67, in <module>
    import distutils.dist, distutils.core, distutils.command, build_exe, sys
ImportError: No module named 'build_exe'

 

How do I use py2exe to make a python executable? Please explain in detail, thanks :/

https://stackoverflow.com/questions/5458048/how-to-make-a-python-script-standalone-executable-to-run-without-any-dependency

Link to post
Share on other sites

I find pyinstaller much easier than py2exe (which I've never gotten to work, even for a hello world script.) 

First use pip to install pyinstaller by running the command

path/to/python/python -m pip install pyinstaller

Then to make an exe, run pyinstaller with the command

path/to/python/Scripts/pyinstaller path/to/script.py

Using the -F flag will force all the necessary files into a single .exe file instead of everything being spread out in the dist directory

path/to/python/Scripts/pyinstaller -F path/to/script.py

Doing this also generates a .spec file that you can edit to change some of the settings then rerun the command. This may be required depending on what libraries your script is using or if you have any data files that need to be included.

1474412270.2748842

Link to post
Share on other sites

16 hours ago, straight_stewie said:

How to make python executable? Easy, stick it in a barrel. Don't let it start wrapping you up before you execute it though, or you might get executed by the python.

how long have you been waiting to tell that joke ?

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to post
Share on other sites

On 24/06/2016 at 2:17 AM, fizzlesticks said:

I find pyinstaller much easier than py2exe (which I've never gotten to work, even for a hello world script.) 

First use pip to install pyinstaller by running the command


path/to/python/python -m pip install pyinstaller

Then to make an exe, run pyinstaller with the command


path/to/python/Scripts/pyinstaller path/to/script.py

Using the -F flag will force all the necessary files into a single .exe file instead of everything being spread out in the dist directory


path/to/python/Scripts/pyinstaller -F path/to/script.py

Doing this also generates a .spec file that you can edit to change some of the settings then rerun the command. This may be required depending on what libraries your script is using or if you have any data files that need to be included.

For the python -m pip install pyinstaller thing, I can't get that to work. It says no module named pip. I am on windows 10.

||| Drakon (Desktop Build) |||

|| CPU: 3800X || Cooler: Kraken X63 || Motherboard: B450 Aorus M || Memory: HyperX DDR4-3200MHz 16G ||

|| Storage: 512GB 970 Pro + 500GB 850 EVO + 250GB 850 EVO + 1TB HDD + 2TB HDD || Graphics Card: RX 5700 XT Red Devil || Case: Thermaltake Core V21 || PSU: XFX XTR 750W 80+Gold || 

 

Link to post
Share on other sites

2 hours ago, Aleksbgbg said:

For the python -m pip install pyinstaller thing, I can't get that to work. It says no module named pip. I am on windows 10.

pip is a package manager that comes installed in newer versions of Python (2.7.9+ for Py2 and 3.4+ for Py3.) If you don't have it, it's time to upgrade your Python. 

1474412270.2748842

Link to post
Share on other sites

3 minutes ago, fizzlesticks said:

pip is a package manager that comes installed in newer versions of Python (2.7.9+ for Py2 and 3.4+ for Py3.) If you don't have it, it's time to upgrade your Python. 

Right thanks.

 

Had python 3.3 for ages, since a friend installed it for me back when I thought virtualbox was python because that was how it works at school ;D

 

Well I will ask if I have other problems, thanks very much for the help.

||| Drakon (Desktop Build) |||

|| CPU: 3800X || Cooler: Kraken X63 || Motherboard: B450 Aorus M || Memory: HyperX DDR4-3200MHz 16G ||

|| Storage: 512GB 970 Pro + 500GB 850 EVO + 250GB 850 EVO + 1TB HDD + 2TB HDD || Graphics Card: RX 5700 XT Red Devil || Case: Thermaltake Core V21 || PSU: XFX XTR 750W 80+Gold || 

 

Link to post
Share on other sites

52 minutes ago, fizzlesticks said:

pip is a package manager that comes installed in newer versions of Python (2.7.9+ for Py2 and 3.4+ for Py3.) If you don't have it, it's time to upgrade your Python. 

So dude, now I get this. I will screenshot for clarity.

Untitled.png

||| Drakon (Desktop Build) |||

|| CPU: 3800X || Cooler: Kraken X63 || Motherboard: B450 Aorus M || Memory: HyperX DDR4-3200MHz 16G ||

|| Storage: 512GB 970 Pro + 500GB 850 EVO + 250GB 850 EVO + 1TB HDD + 2TB HDD || Graphics Card: RX 5700 XT Red Devil || Case: Thermaltake Core V21 || PSU: XFX XTR 750W 80+Gold || 

 

Link to post
Share on other sites

1 hour ago, Aleksbgbg said:

So dude, now I get this. I will screenshot for clarity.

It seems to be a bug in pip when Python is installed to a path with spaces in it. It could be fixed by going through all the Python files in the Scripts folder and quoting the path in the shebang lines, but for laziness sake I'd just reinstall Python to a directory without any spaces in the path. The default used to just be C:/PythonXX not sure why they changed it.

 

edit: Also once that's fixed and you're running pyinstaller, if the path for the script you're making has spaces in it you'll have to quote the path.

pyinstaller "d:\some\path with spaces\my script.py"

1474412270.2748842

Link to post
Share on other sites

4 minutes ago, fizzlesticks said:

It seems to be a bug in pip when Python is installed to a path with spaces in it. It could be fixed by going through all the Python files in the Scripts folder and quoting the path in the shebang lines, but for laziness sake I'd just reinstall Python to a directory without any spaces in the path. The default used to just be C:/PythonXX not sure why they changed it.

 

edit: Also once that's fixed and you're running pyinstaller, if the path for the script you're making has spaces in it you'll have to quote the path.

pyinstaller "d:\some\path with spaces\my script.py"

Thanks. Will write if success/need more help :)

||| Drakon (Desktop Build) |||

|| CPU: 3800X || Cooler: Kraken X63 || Motherboard: B450 Aorus M || Memory: HyperX DDR4-3200MHz 16G ||

|| Storage: 512GB 970 Pro + 500GB 850 EVO + 250GB 850 EVO + 1TB HDD + 2TB HDD || Graphics Card: RX 5700 XT Red Devil || Case: Thermaltake Core V21 || PSU: XFX XTR 750W 80+Gold || 

 

Link to post
Share on other sites

  • 4 months later...
On 26/06/2016 at 9:07 PM, fizzlesticks said:

It seems to be a bug in pip when Python is installed to a path with spaces in it. It could be fixed by going through all the Python files in the Scripts folder and quoting the path in the shebang lines, but for laziness sake I'd just reinstall Python to a directory without any spaces in the path. The default used to just be C:/PythonXX not sure why they changed it.

 

edit: Also once that's fixed and you're running pyinstaller, if the path for the script you're making has spaces in it you'll have to quote the path.

pyinstaller "d:\some\path with spaces\my script.py"

Hey, I'm really sorry to bug you, but to this day I haven't gotten this to work. The above is no longer my issue, it is now this:

http://prntscr.com/d3l1km

 

You seem to know your stuff and it would be great if I could just compile Python :D

||| Drakon (Desktop Build) |||

|| CPU: 3800X || Cooler: Kraken X63 || Motherboard: B450 Aorus M || Memory: HyperX DDR4-3200MHz 16G ||

|| Storage: 512GB 970 Pro + 500GB 850 EVO + 250GB 850 EVO + 1TB HDD + 2TB HDD || Graphics Card: RX 5700 XT Red Devil || Case: Thermaltake Core V21 || PSU: XFX XTR 750W 80+Gold || 

 

Link to post
Share on other sites

16 hours ago, Aleksbgbg said:

Hey, I'm really sorry to bug you, but to this day I haven't gotten this to work. The above is no longer my issue, it is now this:

http://prntscr.com/d3l1km

 

You seem to know your stuff and it would be great if I could just compile Python :D

Take a look at the answers in this SO post http://stackoverflow.com/questions/25254285/pyinstaller-importerror-no-system-module-pywintypes-pywintypes27-dll

1474412270.2748842

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×