Best way to isolate programming projects?
A more generic approach would be use a separate virtualized environment for each project, see virtualization. That could be either:


a container image - more lightweight, faster and definitely more popular these days, see containers
a virtual machine (VM) image, slower and a bit more heavier to maintain than containers


You'd have all the project dependencies (IDEs, libraries, tools, etc) installed inside the virtualized environment, not on your system itself. 

You'd need to create/bring the project's corresponding image on your machine when you start working on it and you can delete or save it for later re-use on some external storage when done. A shared artifact respository would be recommended as storage if more than one developer can work on these projects.

A huge advantage of this approach is that such virtualized environments play really well with automated CI/CD pipelines, in true DevOps spirit, helping to minimize/eliminate the differences between the development and staging/production environments.

Depending on the programming language and/or the supporting development tools being used on a particular project you may have some more specific approaches/alternatives. For example Pipenv or Virtualenv/virtualenv can be used to obtain such isolation for Python projects. But these solutions are typically not usable in other contextes.