简体   繁体   中英

Pygame is correctly installed but won't import in python 2.7 file

System: OSX Yosemite 10.10.5

Language: Python 2.7 (must use 2.7 for class)

IDE: LiClipse

Background: For the longest time I could NOT get pygame to work at all in python. After much research I realized that pygame for mac is 32-bit while the general python 2.7 is 64-bit. So I uninstalled the 64-bit python and reinstalled 32-bit python 2.7.

Problem now: When I enter IDLE, I am able to write

>> import pygame
>> print(pygame.ver)

and

1.9.1release

is successfully returned. No problem in IDLE

HOWEVER

When I enter LiClipse and simply run:

import pygame

The following is returned:

ImportError: No module named pygame

How is this possible if pygame can be imported in IDLE?

确保您的IDE运行相同的python版本和相同的PYTHONPATH环境变量(从两个IDE中检查sys.versionsys.path )。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM