I have Ubuntu 16.04.6 LTS and installed glib version returned by pkg-config --modversion glib-2.0
is 2.48.2.
I want to install latest glib 2.64 for my development uses.
I tried with sudo apt-get install libgtk2.0-dev
but it is saying I have already latest version installed 2.48.2-0ubuntu4.6.
I would recommend upgrading to a later LTS version, or using a VM, a Docker container, or a Flatpak container.
If that's not possible, you might try building it and installing it yourself into a different prefix (configure with meson -Dprefix=/opt/glib
or whatever). You could look into using a tool such as JHBuild to manage the prefix, but it might be more complicated than you need.