'Pip not installing packages into currently configured pyenv

I've been using pyenv for my job for about half a year now and it has been working perfectly, but lats week I noticed that pip suddenly started installing packages into my default python 3.9 and not the pyenv I'm using for a particulat repo, let's call it my_pyenv.

When I run pip install some_package, the package gets installed into my /usr/local/lib/python3.9/site-packages instead of .pyenv/.../versions/my_pyenv/.../site-packages where they should be

This came out of the blue for me as I don't recall changing anything in my configuration and until last week everything was working fine. Now I manually copy the packages, but I'm sure there's an easier way to set this, but so far I couldn't find this issue on Google or Stackoverflow



Sources

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

Source: Stack Overflow

Solution Source