[Tex/LaTex] Installation of pythontex

installingpython

I am trying to install pythontex on Ubuntu 13.04. but cant find the way how.
Downloaded ZIP from http://www.ctan.org/pkg/pythontex.

Tried to follow instructions but unfortunately something went wrong.

Is there any simpler way to do it?
If not, can you please help me by writing instructions step by step?

RE-EDITED:
After installing pythontex when I try to compile e.g.

\documentclass[10pt,a4paper]{article}  
\usepackage[utf8]{inputenc}  
\usepackage{amsmath}  
\usepackage{amsfonts}  
\usepackage{amssymb}  
\usepackage{pythontex}  
\listfiles  

\begin{document}

\begin{pycode}  
def fib(n):    

a, b = 0, 1  
for i in range(n):  
a, b = b, a + b  
return a  
\end{pycode}  

\end{document}  

I get error:

! LaTeX Error: Environment pycode undefined.  
! You can't use `macro parameter character #' in horizontal mode.  
! LaTeX Error: \begin{document} ended by \end{pycode}.  

File List
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
inputenc.sty 2008/03/30 v1.1d Input encoding file
utf8.def 2008/04/05 v1.1m UTF-8 support for inputenc
t1enc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
ot1enc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
omsenc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
amsmath.sty 2000/07/18 v2.13 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
amsfonts.sty 2009/06/22 v3.00 Basic AMSFonts support
amssymb.sty 2009/06/22 v3.00
pythontex.sty


Best Answer

The steps for installing are:

  1. Download the package
  2. Right click the file and click on Extract Here.
  3. Open a terminal (Ctrl+Alt+T) and run these commands:

    cd Downloads/pythontex
    latex pythontex.ins
    md ~/texmf
    md ~/texmf/tex
    mv * ~/texmf/tex
    chmod +x ~/texmf/
    

And the package will be installed. To compile a file:

pdflatex foo.tex
~/texmf/pythontex.py foo.tex
pdflatex foo.tex

I installed the package just now with these commands and now it is working for me.

Related Question