'virtualenvwrapper.sh: There was a problem running the initialization hooks

I'm trying to install virtualenvwrapper. I need to use specific python version: 3.6.10 So I set VIRTUALENVWRAPPER_PYTHON to /usr/local/bin/python3.6
When I run virtualenvwrapper.sh I get an error:

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.6 and that PATH is
set properly.

so I tried to install virtualenvwrapper using the following command python3.6 -m pip install virtualenvwrapper but it resulted with another error: Segmentation fault (core dumped)

How can I fix this? Is there any workaround for installing virtualenvwrapper to specific python version?

More info:
python3.6 --version : Python 3.6.10
python3 --version : Python 3.9.7
I use Ubuntu 21.10



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source