Problem with esp32 debug for Ubuntu. (undefined symbol: _Py_ZeroStruct)

Thank you for helping me. Here are the answers to your questions.

Did you remove your old symlinks thereafter? I removed them today. It doesn’t help.
What version of Python do you have installed? Python 2.7.18rc1 /user/bin/python
Which version of Ubuntu are you running? Ubuntu 20.04 LTS (Just installed from scratch a week ago.)
Do you have Anaconda Python installed on the system? No.

I have also installed Platform IO and set up the debug mode on my Windows 10 PC. It works flawlessly. So, the hardware and software should be working. It may be just some setup issue. I would love to have it running under Ubuntu!

Below shows the details on how I removed the symlink and tried to install version 5.

Yesterday, I created these 3 symlinks for the errors displayed by Platform IO.
sudo ln -s /usr/lib/x86_64-linux-gnu/libncurses.so.6.2 /usr/lib/x86_64-linux-gnu/libncurses.so.5
sudo ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6.2 /usr/lib/x86_64-linux-gnu/libtinfo.so.5
sudo ln -s /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0 /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0

Today, I removed these 3 symlinks.
sudo rm libncurses.so.5
sudo rm libtinfo.so.5
sudo rm libpython2.7.so.1.0

I get the same error regarding version 5 again. I have version 6 installed.
undefinedpiogdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory (taken Platfrom IO Debug Console Window)

I tried to install version 5.
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ sudo apt-get install libncurses5-dev libncursesw5-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
libncurses5-dev is already the newest version (6.2-0ubuntu2).
libncursesw5-dev is already the newest version (6.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$

michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ ls -ltr libncurses.so*
-rw-r–r-- 1 root root 162024 Feb 25 23:14 libncurses.so.6.2
-rw-r–r-- 1 root root 31 Feb 25 23:14 libncurses.so
lrwxrwxrwx 1 root root 17 May 11 14:16 libncurses.so.6 -> libncurses.so.6.2
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$

Version 6.2 is installed. It doesn’t make the errors go away.