![]() |
Prev | Next | install |
tar -xvzf pycppad-20140710.tar.gz
which would create the directory pycppad-20140710
.
pycppad-20140710/setup.py
must be set to agree with your system:
# Directory where CppAD include files are located
# cppad_include_dir = [ '/usr/include' ]
cppad_include_dir = [ os.environ['HOME'] + '/prefix/cppad/include' ]
#
# Directory where Boost Python include files are located
boost_python_include_dir = [ '/usr/include' ]
#
# Director whre Boost Python library is located
# boost_python_lib_dir = [ '/usr/lib' ]
boost_python_lib_dir = [ '/usr/lib64' ]
#
# Name of the Boost Python library in boost_python_lib_dir.
# boost_python_lib = [ 'boost_python-mt' ]
boost_python_lib = [ 'boost_python' ]
Note that Boost Python and CppAD must be installed before you can
properly set this information.
pycppad-20140710
and execute the command
./setup.py build_ext --inplace --debug --undef NDEBUG
to compile and link a version of the CppAD extension module
with debugging (improved error messaging).
./setup.py build_ext --inplace
Note that in the optimized version, certain error checking is not
done and improper use of pycppad.cpp
may lead to a segmentation fault.
gcc
, the warning
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
will be printed.
This is not requested by setup.py
but is rather a bug
in the Python
distutils
package.
rebaseall
program.
For example, execute the following steps:
ps -e
command,
and shut them all down.
Start | Run
and then enter cmd
in as the program to run.
bin
directory.
If you installed cygwin in the default location, the following command
will do this:
cd c:\cygwin\bin
ash
shell by executing the command
ash.exe
/usr/bin/rebaseall
This will take a few minutes to execute.
When it is done, you can close the command window by executing
the command exit
twice.
pycppad
documentation.
Change into the directory pycppad-20140710
and execute the command
python test_example.py
You can run some more tests with the command
python test_more.py with_debugging
where
with_debugging
is True
or False
depending on if you built
with debugging
.
cppad_
being missing,
it is probably because you did not use the --inplace
flag
when you built
pycppad
.
pycppad
copies it to the standard location for you system.
You may or may not preform this step:
Change into the directory pycppad-20140710
and execute the command
./setup.py build_ext --debug --undef NDEBUG install --prefix=prefix
or
./setup.py build_ext install --prefix=prefix
where
prefix
is the prefix for the location
where you wish to install pycppad
.
Note that some common choices for
prefix
are
$HOME | if you are not the system administrator for this machine |
/usr/local |
you're administrator and the system
has a package manager (like yum , apt-get ).
|
/usr | you're the administrator but the system does not have a package manager. |
distutils
package does not provide
an uninstall command. You can uninstall the pycppad
package
by removing the entries
prefix/lib/pythonmajor.minor/site-packages/pycppad
prefix/lib/pythonmajor.minor/site-packages/pycppad-20140710.egg-info
prefix/share/doc/pycppad
where
major
and
minor
are the major and minor version numbers printed by the command
python --version
pycppad
,
you will not be able to use the python command
import pycppad
unless the distribution directory
pycppad-20140710
is in your python path.
If you have installed pycppad
,
the installation directory
prefix/lib/pythonmajor.minor/site-packages
must be in you python path (to use the import pycppad
command).
You can check your python path with the following commands
python
import sys
sys.path
If the required directory is not yet there,
you could add the directory above to your python path using the command
sys.path.append('prefix/lib/pythonmajor.minor/site-packages')
You can avoid having to do this every time you load python by adding
the path to your environment variable PYTHONPATH
.
For example, if you are using the bash
shell, you could
add the command
export PYTHONPATH="prefix/lib/pythonmajor.minor/site-packages"
to your $HOME/.bashrc
file.
pycppad
starts out in the directory
pycppad-20140710/doc
During the installation process, it is copied to the directory
prefix/share/doc/pycppad