Different sys.path between pypy and normal python

那年仲夏 提交于 2019-12-13 02:35:47

问题


I'm trying to use pypy compiler to run my python code but the sys.path for pypy is different from normal python compiler so when I tried to import default modules such as

import pygame

it fails in pypy, stating that the module is not found, while it works correctly with the normal python command. Any help is greatly appreciated.


回答1:


I think you're expecting any module installed for CPython to work with PyPy out of the box. That's not the case. It's the same when you upgrade from CPython 2.6 to CPython 2.7: the modules you have already installed for 2.6 are not automatically available for 2.7, and must be re-installed. Similarly, you must re-install the modules for PyPy.

This said, the standard pygame doesn't work too well with PyPy, but stay tuned; it seems someone is working on a version of pygame based on cffi, which should work very well with PyPy.



来源:https://stackoverflow.com/questions/17187959/different-sys-path-between-pypy-and-normal-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!