Import module CairoPlot fails in Python
質問
I'm using cairo plot to draw charts with python. I followed the instruction as stated on the website to install Cairplot, http://linil.wordpress.com/2008/09/16/cairoplot-11/ :
sudo apt-get install bzr bzr branch lp:cairoplot/1.1
The installation completes successfully. I then try to import the modules in python:
>>> import CairoPlot Traceback (most recent call last): File "<stdin>",
line 1, in <module> ImportError: No
module named CairoPlot
>>> import cairo
>>>
Importing cairo is fine, but I can't figure out why I am not able to import CairoPlot.
解決
bzr branch lp:cairoplot/1.1
creates a directory called 1.1
in your current working directory. Inside you'll find CairoPlot.py
. Move CairoPlot.py
into a directory which is listed in your PYTHONPATH
, or edit your PYTHONPATH
to include (the unfortunately named) 1.1
.
他のヒント
Is the directory where CairoPlot is installed in your $PYTHONPATH
? Do you need to run any setup scripts, like setuptools?
The repository appears to include a setup.py file, so you likely need to run setuptools to fully install the module.