deepin-15已经预装Python2/3,可以满足基本的编程需求。
1、若需导入turtle来完成一些程序,则需要补充安装python-tk库:
#为Python2中使用turtle预先打好基础
sudo aptitude -y install python-tk
下面提供一段Python代码以便确认这个编程环境正常
# -*- coding: utf-8 -*-
import turtledef drawSnake(rad,angle,len,neckrad): for i in range(len): turtle.circle(rad,angle) turtle.circle(-rad,angle) turtle.circle(rad,angle/2) turtle.fd(rad) turtle.circle(neckrad+1,180) turtle.fd(rad*2/3)turtle.setup(1300,800,0,0)
pythonsize=30turtle.pensize(pythonsize)turtle.pencolor("blue")turtle.seth(-40)drawSnake(40,80,5,pythonsize/2) 2、系统没有预装Pygame,如果需要用它来做游戏编程,就得自己安装一下
#为Python2中使用Pygame预先打好基础
sudo aptitude -y install python-pygame
下面提供一段Python代码以便确认这个编程环境正常
# -*- coding: utf-8 -*-
import pygame,sysfrom pygame.locals import *white = 255,255,255
blue = 0,0,255pygame.init()screen = pygame.display.set_mode((400,300))myfont = pygame.font.Font(None,30)textImage = myfont.render("SHIT HAPPENS",True,white)txtImage = myfont.render("iDUANG",True,white)while True: for event in pygame.event.get(): if event.type in (QUIT,KEYDOWN): sys.exit() screen.fill(blue) screen.blit(textImage,(50,50)) screen.blit(txtImage,(100,150)) pygame.display.update()