Installation of matplotlib-cpp on ubuntu

于小乐

Installation of Matplotlib-cpp on Ubuntu


matplotlib-cpp:

https://github.com/lava/matplotlib-cpp


To remove python 3.8:

sudo apt-get -y purge python3.8
sudo apt-get -y autoremove


To install python 3.10:

sudo apt install software-properties-common -y<br/>sudo add-apt-repository ppa:deadsnakes/ppa<br/>sudo apt install python3.10-dev


Setup Makefile (Note location of python and CXXFLAGS):

CXX = g++
# CXX = clang++

CXXFLAGS= -Wall -Wno-uninitialized -DWITHOUT_NUMPY -I/usr/include/python3.10 -lpython3.10 -g -O0


OBJECTFILES = a.o b.o
TARGET = c

all: ${TARGET}

${TARGET}: ${OBJECTFILES}
	$(CXX) -o ${TARGET} ${OBJECTFILES} ${CXXFLAGS}

clean:
	/bin/rm -f ${TARGET} *.o
	/bin/rm -f *.png


To install matplotlib:

python3.10 -m pip install -U pip
python3.10 -m pip install -U matplotlib


ModuleNotFoundError: No module named 'distutils.util'

sudo apt-get install python3.10-distutils 


ImportError: cannot import name 'html5lib' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py)

curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10