WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Convert .py to .exe and install in sd card  (Read 2046 times)

Offline Aladin

  • Newbie
  • *
  • Posts: 40
Convert .py to .exe and install in sd card
« on: April 01, 2020, 11:55:08 AM »
I want to convert .py file to .exe and install it in the sd card and run it
Can someone help me

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Convert .py to .exe and install in sd card
« Reply #1 on: April 01, 2020, 04:33:17 PM »
You don't usually have .exe files in Linux.

Offline Aladin

  • Newbie
  • *
  • Posts: 40
Re: Convert .py to .exe and install in sd card
« Reply #2 on: April 02, 2020, 10:45:01 AM »
How can you make a Python script executable on Unix?
 Put #!  / Usr / bin / env python in the first line of your .py script.

 Add execute permissions to the file (using chmod).

 Run the script from the command line, for example.  by providing ./my_script.py in the same directory.

Is this ok ?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11595
Re: Convert .py to .exe and install in sd card
« Reply #3 on: April 02, 2020, 11:01:40 AM »
Hi Aladin
How can you make a Python script executable on Unix? ...
How you ask your question is important. Your initial questions sounded like you were trying to mix Linux and Windows programs.

Place this as the first line in your script:
Code: [Select]
#!/usr/bin/env python
Set file permissions:
Code: [Select]
chmod 775 MyScript.py
Execute script:
Code: [Select]
./MyScript.py

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14803
Re: Convert .py to .exe and install in sd card
« Reply #4 on: April 02, 2020, 11:11:39 AM »
You may need /usr/bin/env python3 if using the python3.6 extension.