python:pymedia安装
"Pymedia is a Python library for accessing and manipulating media files. It makes audio and video playback/creation a snap for even a newcomer to programming." There is a deb installer available for pymedia 1.3.5 but not for 1.3.7 So I decided to write this howto.First install all the dependencies:
sudo apt-get install python-dev libogg-dev libvorbis-dev liblame-dev libfaad2-dev libasound2-dev python-pygame
(Pygame is not really necessary, but recommended.)
Extract a download of pymedia-*.tgz and open a terminal in the extracted folder, so we can build pymedia:
python setup.py build
This should display:
Using UNIX configuration...
OGG : found
VORBIS : found
FAAD : found
MP3LAME : found
VORBISENC : found
ALSA : found
Continue building pymedia ? :
If everything is found press Y
Finally install pymedia:
sudo python setup.py install
Test if pymedia installed correctly by typing this at the python shell:
import pymedia
==================
Recently, I needed to use pymedia, for some audio and video encoding. The problem though, is that pymedia was nowhere to be found in the Ubuntu Hardy Heron package repository, and the only .deb installation candidate from the pymedia website was for an older version of pymedia and Python 2.4. Not wanting to run an old version and having Python 2.5 as a requirement, I needed to compile the package myself–no easy task, it turns out.
Step 1. Get pymedia
wget http://internap.dl.sourceforge.net/sourceforge/pymedia/pymedia-1.3.7.3.tar.gz
tar xzvf pymedia-1.3.7.3.tar.gz
cd pymedia-*
Step 2: Get the pymedia dependencies (as noted here).
sudo apt-get install python-dev libogg-dev libvorbis-dev liblame-dev libfaad-dev libasound2-dev python-pygame
Step 3. Get GCC 3.4 (pymedia will not compile with GCC 4.0)
sudo apt-get install gcc-3.4 g++-3.4
export CC=gcc-3.4
Step 4. Build/compile pymedia
python setup.py build
Step 5. Be a good Ubuntu user with checkinstall
Checkinstall is great because it installs the package as a .deb file.
sudo apt-get install checkinstall
sudo checkinstall python setup.py install
Note: If you want to be a bad Ubuntu user, you can run “sudo python setup.py install” instead of the checkinstall command.
Step 6. Try it out
python
>>> import pymedia
页:
[1]