0

Hi I am trying to make use of pypy on my Python 2.7 application running in windows XP. Just read a little on psyco and it seems pretty easy to use see http://psyco.sourceforge.net/psycoguide/node8.html

if __name__ == '__main__':
    # Import Psyco if available
    try:
        import psyco
        psyco.full()
    except ImportError:
        pass
    # ...your code here...

However I realised that psyco doesn't support python 2.7, shame, so pypy being the new hotness, I was wondering how to make use of it in my application. I can't seem to see how I "import" it and make it work as the example above. My application is not just a single .py file but an entire text editor I am writing using pyqt, I would very much like to speed things up. Any suggestions of how to use pypy similar to the above code Any alternatives that would allow me to do something similar to the above?

Many thanks

I just want to clarify, maybe it wasn't clear earlier. currently i use py2exe to create an executable of my application. I have a setup.py file and I run python setup.py py2exe, this creates the executable that I distribute. Now I want to speed up the application so that when I distribute it, the entire application runs faster. Now how do I make use of pypy again to create a faster executable application that I can distribute?

user595985
  • 1,543
  • 4
  • 29
  • 55

1 Answers1

2

Pypy is run instead of the CPython executable.

So, when you up until now ran

python mypythonfile.py

Or similar, with pypy you just run

pypy mypythonfile.py

It is a drop-in replacement. You do not need to import anything, especially not psyco

Tobias
  • 3,026
  • 20
  • 34
  • Thanks Tobias, I have just added to the question a little clarification about how I currently create a distributable executable. I am not 100% clear how I can use pypy to create an executable that runs faster. Does runing pypy my_main_pthonfile.py create another .py file that I should use in my setup.py to create a faster executable that I can distribute? Again thanks for helping – user595985 Mar 16 '14 at 17:57
  • To my knowledge, pypy does not support any py2exe scheme, it is solely run like `pypy file`. When you want to use pypy, just ship the .py files and execute them with pypy. – Tobias Mar 16 '14 at 20:48