2015-09-04 174 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的反正是不推薦)。