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/3.6.0/Python-3.6.0.tar.xz tar -Jxf Python-3.6.0.tar.xz cd Python-3.6.0 ./configure --enable-shared --enable-optimizations --with-ensurepip=install --prefix=/fcopt/python3.6.0 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/python3.6.0/bin:/usr/bin:/bin export PYTHONPATH=/fcopt/python3.6.0/lib/python3.6/site-packages export LD_LIBRARY_PATH=/fcopt/python3.6.0/lib
To test the installation, I use pip3 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.0.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.0/VTK-7.0.0.tar.gz tar zxvf VTK-7.0.0.tar.gz mkdir VTK-7.0.0-py3.6.0 cd VTK-7.0.0-py3.6.0 ccmake -DCMAKE_INSTALL_PREFIX:PATH=/fcopt/VTK/vtk7.0-py3.6.0 \ -DBUILD_SHARED_LIBS:BOOL=ON \ -DVTK_WRAP_PYTHON:BOOL=ON \ -DVTK_PYTHON_VERSION:STRING=3 \ -DPYTHON_EXECUTABLE:PATH=/fcopt/python3.6.0/bin/python3 \ -DPYTHON_INCLUDE_DIR:PATH=/fcopt/python3.6.0/include/python3.6m \ -DPYTHON_LIBRARY:PATH=/fcopt/python3.6.0/lib/libpython3.6m.so \ ../VTK-7.0.0
To 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.0-py3.6.0/lib/python3.6/site-packages export LD_LIBRARY_PATH=/fcopt/VTK/vtk7.0-py3.6.0/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/python3.6.0/bin/python3 configure.py make make instal
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/python3.6.0/bin/python3 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/python3.6.0/bin:/usr/bin:/bin export PYTHONPATH=/fcopt/python3.6.0/lib/python3.6/site-packages:/fcopt/VTK/vtk7.0-py3.6.0/lib/python3.6/site-packages export LD_LIBRARY_PATH=/fcopt/python3.6.0/lib:/fcopt/VTK/vtk7.0-py3.6.0/lib export MPLBACKEND=Qt4Agg
When saving a mlab figure in pdf format , I have the following error: