pygame not working with portable python

2019-02-27 13:22发布

问题:

I'm trying to get pygame working with portable python 3.2.1.1 running off a USB stick, but when I use the following code:

import pygame, sys

It says:

ImportError: No module named pygame

My understanding was that pygame came embedded in portable python. Can anyone help?

回答1:

Pygame does not come embeded in portable python 3.2. Tho it comes in the 2.7 version.

Sources: http://portablepython.com/wiki/PortablePython3.2.1.1 - 3.2 (No pygame here!) http://portablepython.com/wiki/PortablePython2.7.3.1 - 2.7 (Pygame embeded!)



回答2:

Running Pygame on Portable Python....

On Windows 7 download and copy the msi file into your portable directory. Double-click the msi file. When prompted for the directory, change to the USB drive. Once done, copy the library and site packages contents to the USB library and site packages.

To test, bring up Python interpreter, then type "import pygame".

If successful, you will not receive an error when importing.