Mariem Bf

Q: how to run python executable file for linux over mac ?

I have an executable file coded in python. I can run this program over linux but not over Mac.

 

Have you an idea to how run it please ?

Thanks.

Posted on Sep 1, 2016 7:54 AM

Close

Q: how to run python executable file for linux over mac ?

  • All replies
  • Helpful answers

  • by Grant Bennet-Alder,Solvedanswer

    Grant Bennet-Alder Grant Bennet-Alder Sep 1, 2016 10:10 AM in response to Mariem Bf
    Level 9 (60,585 points)
    Desktops
    Sep 1, 2016 10:10 AM in response to Mariem Bf

    Python is available in Terminal, which provides a unix command-line environment.

     

    Some python applications may need to be re-compiled to run on Mac. You may need to download and Install Xcode tools to get full access to all the compilers and related tools.

  • by Mariem Bf,

    Mariem Bf Mariem Bf Sep 2, 2016 2:08 AM in response to Grant Bennet-Alder
    Level 1 (4 points)
    Desktops
    Sep 2, 2016 2:08 AM in response to Grant Bennet-Alder

    Thank you for your answer. To install xcode, should I update my system and migrate to El Capitan 10.11 because I have  OS X Yosemite 10.10.5 ?

  • by Grant Bennet-Alder,

    Grant Bennet-Alder Grant Bennet-Alder Sep 2, 2016 7:10 AM in response to Mariem Bf
    Level 9 (60,585 points)
    Desktops
    Sep 2, 2016 7:10 AM in response to Mariem Bf

    Did you try some Python first?

    Does it already have the right Python for what you are doing?

    10.11.6 with Xcode has this version:

    $ python

    Python 2.7.10 (default, Oct 23 2015, 19:19:21)

    [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin

    Type "help", "copyright", "credits" or "license" for more information.

    >>>

  • by etresoft,

    etresoft etresoft Sep 2, 2016 8:43 AM in response to Mariem Bf
    Level 7 (29,041 points)
    Sep 2, 2016 8:43 AM in response to Mariem Bf

    Hello Mariem Bf,

    In most cases, Python is a scripting language. There is no executable.

     

    If you are having trouble running a Python script on a Mac, the best course of action is to try to run it and then reply to this thread with the output from the Terminal, as Grant Bennet-Alder has done.

  • by Mariem Bf,

    Mariem Bf Mariem Bf Sep 2, 2016 9:09 AM in response to Grant Bennet-Alder
    Level 1 (4 points)
    Desktops
    Sep 2, 2016 9:09 AM in response to Grant Bennet-Alder

    Yes Python works : I have this message :

     

    Python 2.7.10 (default, Jul 14 2015, 19:46:27)

    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin

    Type "help", "copyright", "credits" or "license" for more information.

    >>>

    But as I said to you I don'y have 10.11 version for mac I have OS X YOsemite 10.10.5. So I don't know if I should do the update to run Xcode or not, and how to use it on mac ?

  • by Mariem Bf,

    Mariem Bf Mariem Bf Sep 2, 2016 9:13 AM in response to etresoft
    Level 1 (4 points)
    Desktops
    Sep 2, 2016 9:13 AM in response to etresoft

    When I run my script I see this message :

     

    ./Storer

    -bash: ./Storer: cannot execute binary file

  • by VikingOSX,

    VikingOSX VikingOSX Sep 2, 2016 10:06 AM in response to Mariem Bf
    Level 7 (20,544 points)
    Mac OS X
    Sep 2, 2016 10:06 AM in response to Mariem Bf

    Linux executables are not compatible with OS X. A Python script that has not been made executable in the Bash shell is another reason for your Bash error message. Any Linux dependencies will explode your Python script.

    $ chmod +x ./Storer.py

    $ ./Storer.py

     

    It is possible to create a launchable OS X Python (.app) application using the py2applet and py2app utilities that are located in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/bin folder. Normally, one has a GUI interface coded into Python to have any practical use of these utilities. Apple continues to ship a horribly out of date Tk/Tcl Frameworks (8.5.9), and if you are using that GUI, then I recommend updating to Active States current solution.

     

    If you plan to use py2app on OS X Yosemite, you will need at minimum, the Xcode for Command Line Tools (OS X 10.10) for Xcode 7.2 installed. You will need a free developer account to access this download. This is just the compilation environment, and not Xcode proper. OS X 10.11 breaks py2app.

     

    Python is always installed by OS X itself. Do not attempt to modify, or replace the System Python with a newer or different version. System utilities expect the original OS X installed version for proper function.

  • by Mariem Bf,

    Mariem Bf Mariem Bf Sep 5, 2016 6:42 AM in response to VikingOSX
    Level 1 (4 points)
    Desktops
    Sep 5, 2016 6:42 AM in response to VikingOSX

    Thanks for your detailed response. I could understand the relation between xcode and py2app. I install Xcode 7.2 and I try to edit a python application but I don't find python option(I find C, C++ ..).

     

    My application is an executable file (binary file) so I don't know if I can edit it with xcode.

  • by Mariem Bf,

    Mariem Bf Mariem Bf Sep 5, 2016 6:44 AM in response to Mariem Bf
    Level 1 (4 points)
    Desktops
    Sep 5, 2016 6:44 AM in response to Mariem Bf

    Thanks for your detailed response. I couldn't understand the relation between xcode and py2app. I install Xcode 7.2 and I try to edit a python application but I don't find python option(I find C, C++ ..).

     

    My application is an executable file (binary file) so I don't know if I can edit it with xcode.

  • by VikingOSX,

    VikingOSX VikingOSX Sep 5, 2016 8:25 AM in response to Mariem Bf
    Level 7 (20,544 points)
    Mac OS X
    Sep 5, 2016 8:25 AM in response to Mariem Bf

    You cannot edit your binary executable Linux application, or any other executable in Xcode. You must have the original Python source code. Py2app has nothing to do with Xcode, and as I pointed out earlier, it is located in the System Python Framework (library).

     

    Unless you have the Python source code for your Linux executable, then you are done.

     

    My Python development consists of a create/test/debug cycle in the OS X Terminal using Sublime Text 3 editor with the Anaconda package for syntax checking, and the Python idle IDE for interactive test/debug. I do not use Xcode in this process.