15

I was wondering how to use PyPy 1.8 on Windows XP 32-bit. I downloaded the zip file off the website and installed it into a My Documents file. Initially, I thought it was similar to psyco in that I had to "import psyco," but I found that PyPy.exe acted like the Python command line instead.

I tried dragging my scripts into the PyPy.exe to run them, but it didn't seem to work at all. Attempting to use the "python" command within PyPy yielded a "global name 'python' is not defined."

So I was hoping if someone can assist me in making PyPy run because I'm pretty much out of ideas. The documentation on the PyPy website confused me mainly and was not very helpful.

Ans: I found that I could simply right-click the script and "Open with" Pypy.exe to make it work. Not sure why it didn't work with the drag since I thought that was equivalent. Thanks everyone.

chrtan
  • 1,704
  • 1
  • 13
  • 17
  • 2
    It's a python implementation. You use it just like you would CPython. – Marcin Mar 27 '12 at 16:15
  • @Marcin That's what I tried. However, without an "IDLE" window that conveniently allows me to open and run scripts, I am admittedly lost when it comes to running them. And I tried using the PyPy command line and ended up with the result you see above. I am a newbie when it comes to programming and computers in general, so I apologize if the answer is something extremely obvious. – chrtan Mar 27 '12 at 16:20
  • 3
    Then you need help in using the interactive Python interpreter, not in using PyPy. Rephrase your question and title, or someone who would give a good answer might miss it. –  Mar 27 '12 at 16:47
  • 1
    Read the python docs on command line usage. Basically running "python" from the command line starts the interpreter, and "python -m script.py" runs the script called "script.py" – aquavitae Mar 27 '12 at 16:49
  • 1
    You just type your python into the interpreter, line by line. As long as all of the indentation is consistent (and starts at zero), you can paste in blocks of code. – Marcin Mar 27 '12 at 16:50
  • If you're a beginner, it's probably worth getting comfortable with the standard Python from python.org before you try to explore other implementations. – Thomas K Mar 27 '12 at 17:16
  • If you've found the solution, you should answer your own question and accept that answer so it will show up as an answered question – David Robinson Mar 27 '12 at 18:12

3 Answers3

42

I'm a noob and was totally confused as well so here's what I did in case it helps someone. I guess this is so basic that pypy doesn't mention it.

  1. Download the appropriate file based on your OS: http://pypy.org/download.html

  2. unzip/uncompress/unpack/extract to any directory eg: C:\

  3. navigate to the directory in windows explorer and copy the path, eg: C:\pypy-2.5.0-win32

  4. control panel>system>advanced system settings>environment variables

  5. in the first box, select PATH

  6. click edit

  7. You'll see a bunch of paths. Don't alter any of them. Move the cursor to the very end.

  8. type a semicolon: ;

  9. paste your path after the semicolon you just added to the end of the long list of paths eg: ;C:\pypy-2.5.0-win32

Note! The command will be the filename of the launcher name -.exe If your launcher is pypy3.exe, then the command will be pypy3.

If the filename is python.exe, then your command will be python and so on.

For pypy3 the default launcher is pypy3.exe

  1. close all the system setting boxes and exit shell if it's open

  2. open shell

  3. navigate to directory where your .py file is located

  4. type: pypy filename.py

Now you can run your code with pypy instead of python.

25r43q
  • 613
  • 4
  • 16
MDE
  • 421
  • 4
  • 3
9

Maybe I'm not following what you're trying to do, but isn't it just a question of opening a command prompt and running pypy myscriptname ? Assuming you've got all the paths for PyPy and your script straight, anyway (e.g. your script's in PyPy's folder).

ChrisC
  • 1,282
  • 9
  • 9
0
  1. install Chocolatey
  2. choco install python.pypy -y