2015-09-04 259 views
2
[email protected]:~/Desktop/pygame-1.9.1release$ which python 
/home/abhigenie92/anaconda/bin/python 
[email protected]:~/Desktop/pygame-1.9.1release$ sudo apt-get install python-pygame 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
python-pygame is already the newest version. 
0 upgraded, 0 newly installed, 0 to remove and 224 not upgraded. 
[email protected]:~/Desktop/pygame-1.9.1release$ python 
Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 17:02:03) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
Anaconda is brought to you by Continuum Analytics. 
Please check out: http://continuum.io/thanks and https://binstar.org 
>>> import pygame 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named pygame 

什么上面发生模块?它似乎不安装anaconda。但它正在从道路向右转。无法安装蟒蛇

+0

您是否尝试过从安装pip的anacondas安装? – Simon

+0

@Simon我试过'须藤PIP安装汞柱+ HTTP:// bitbucket.org/pygame的/ pygame' 这表明'成功安装pygame'。但仍然anaconda python没有显示这样的模块。 –

+0

我不确定anaconda是否设置了任何种类的virtualenv - 我会认为它确实如此。我不在linux上使用anaconda,但在使用anacondas pip安装的窗口中,我会这样做:'/home/abhigenie92/anaconda/bin/pip.exe install pygame'。 Linux自带python安装,安装anaconda将安装第二个,因此您需要导航到anacondas pip所在的位置并使用该安装模块。使用'sudo pip install pygame'将只使用linux附带的基本python – Simon

回答

1

您正在将东西安装到系统Python中。您需要安装到蟒蛇Python中,使用pip install pygame(注意:sudo pip很可能会再次使用该系统的Python,并使用sudo与蟒蛇Python的反正是不推荐)。