I assume the installation directory /fcopt I choose is writeable (for me), otherwise one have to install as root.
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz tar -Jxf Python-2.7.13.tar.xz cd Python-2.7.13 ./configure --enable-shared --enable-optimizations --with-ensurepip=install --prefix=/fcopt/python2.7.13 make make install
The command make -j 4 failed with a core dump on my laptop so I only use make command.
The option –enable-shared is needed when building VTK python wrapper.
The option –with-ensurepip=install permits the installation of setuptools and pip packages.
Installed versions are pip-9.0.1 and setuptools-28.8.0.
To correctly use and test this installed python version
export PATH=/fcopt/python2.7.13/bin:/usr/bin:/bin export PYTHONPATH=/fcopt/python2.7.13/lib/python2.7/site-packages export LD_LIBRARY_PATH=/fcopt/python2.7.13/lib
To test the installation, I use pip to install ipython package:
The mayavi package requires VTK (with ccmake command) and PyQt package to be installed.
I have some troubles when compiling version 6.3.0 of VTK, so I install version 7.1.0. I choose as installation directory /fcopt/VTK/vtk7.0-py3.6.0 which is writeable for me.
wget http://www.vtk.org/files/release/7.1/VTK-7.1.0.tar.gz tar zxvf VTK-7.1.0.tar.gz mkdir VTK-7.1.0-python2.7.13 cd VTK-7.1.0-python2.7.13 ccmake -DCMAKE_INSTALL_PREFIX:PATH=/fcopt/VTK/vtk7.1.0-py2.7.13 \ -DBUILD_SHARED_LIBS:BOOL=ON \ -DVTK_WRAP_PYTHON:BOOL=ON \ -DVTK_PYTHON_VERSION:STRING=2 \ -DPYTHON_EXECUTABLE:PATH=/fcopt/python2.7.13/bin/python \ -DPYTHON_INCLUDE_DIR:PATH=/fcopt/python2.7.13/include/python2.7 \ -DPYTHON_LIBRARY:PATH=/fcopt/python2.7.13/lib/libpython2.7.so \ ../VTK-7.1.0
After 35mn on my laptops, I can test the VTK python wrapper: one have to add paths to the previously initialized environment variables PYTHONPATH and LD_LIBRARY_PATH:
export PYTHONPATH=$PYTHONPATH:/fcopt/VTK/vtk7.1.0-py2.7.13/lib/python2.7/site-packages export LD_LIBRARY_PATH=/fcopt/VTK/vtk7.1.0-py2.7.13/lib:$LD_LIBRARY_PATH
We first have to install sip package. The environment variables PATH, PYTHONPATH and LD_LIBRARY_PATH must be correctly set.
wget https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.1/sip-4.19.1.tar.gz tar zxvf sip-4.19.1.tar.gz cd sip-4.19.1 /fcopt/python2.7.13/bin/python configure.py make make install
Then we can install PyQt4 package (PyQt5 failed?)
wget https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.12/PyQt4_gpl_x11-4.12.tar.gz tar zxf PyQt4_gpl_x11-4.12.tar.gz cd PyQt4_gpl_x11-4.12 /fcopt/python2.7.13/bin/python configure-ng.py make sudo make install
To quickly test the PyQt4 package, one can run the python code pyqt4_window.py (339 bytes) .
I choose to install matplotlib package after the installation of PyQt.
To quickly test the mayavi package, one can run the python code mayavi_boy.py (774 bytes) .
With this installation, I set the environment variables PATH, PYTHONPATH and LD_LIBRARY_PATH before to use python3, ipython3, ... as follows
export PATH=/fcopt/python2.7.13/bin:/usr/bin:/bin export PYTHONPATH=/fcopt/python2.7.13/lib/python2.7/site-packages:/fcopt/VTK/vtk7.1.0-py2.7.13/lib/python2.7/site-packages export LD_LIBRARY_PATH=/fcopt/python2.7.13/lib:/fcopt/VTK/vtk7.1.0-py2.7.13/lib export MPLBACKEND=Qt4Agg
When saving a mlab figure in pdf format , I have the following error:
rmatique:Python