Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Compile Python, Matlab and Python

  1. Mar 13, 2009 #1
    1) I know that python is an interpreted language. But is there a way to compile to code to make it process faster?

    2) Suppose I have a huge array of data. I want to process it. If I were to run the process through python(with numpy and scipy), Matlab, and Mathematica which one would be able to process it the fastest?
  2. jcsd
  3. Mar 14, 2009 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    You might look into http://psyco.sourceforge.net/ .
    I have no experience with it. Please report back if it works.

    I think the answer to this really depends on
    what specific tasks you want done
    and how optimized your program is [with respect to the platform chosen].

    You may have to also consider memory usage for your data (including data structures) and memory usage and overhead for the running program.
  4. Mar 14, 2009 #3
    Thank you. Psyco looks very interesting. So does PyPy.

    Another question is:
    If compilers convert Java,C++,C to the same machine code(I don't know if they really do), and if I were to use a program to compile some Python file into machine code, could I use that code in some C++ application?
  5. Feb 7, 2012 #4
    If you're looking to compile into an executable, and are on windows, check http://www.py2exe.org/

    What do you mean by use some python code in c++? If you mean to have your python script talk with your c++ program, you can simply have them communicate through sockets.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook