ubuntu下载python模块慢_在Ubuntu上安装python模块

I need to install some modules for python on Ubuntu Linux 12.04. I want pygame and livewires but I'm not sure how to install them.

I have the py file for livewires, which has been specially edited (from a book I'm reading) and I want to install it but I'm not sure how to, I also want to install pygame.

解决方案

There are two nice ways to install Python packages on Ubuntu (and similar Linux systems):

sudo apt-get install python-pygame

to use the Debian/Ubuntu package manager APT. This only works for packages that are shipped by Ubuntu, unless you change the APT configuration, and in particular there seems to be no PyGame package for Python 3.

The other option is to use PIP, the Python package manager:

sudo apt-get install python3-pip

to install it, then

sudo pip3 install pygame

to fetch the PyGame package from PyPI and install it for Python 3. PIP has some limitations compared to APT, but it does always fetch the latest version of a package instead of the one that the Ubuntu packagers have chosen to ship.

EDIT: to repeat what I said in the comment, pip3 isn't in Ubuntu 12.04 yet. It can still be installed with

sudo apt-get install python3-setuptools

sudo easy_install3 pip

sudo apt-get purge python-pip

After this, pip is the Python 3 version of PIP, instead of pip3. The last command is just for safety; there might be a Python 2 PIP installed as /usr/bin/pip.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值