r/learnpython • • 8d ago

Virtual Environment and Python

I have started learning python and decided to use pycharm as an editor. I want to know anything which will help me in this journey.

My main question is => I don't get "virtual environment" thing with python. I cloned a repo and opened it in pycharm, it says "No python interpreter configured for <repo-name>" and then suggested to create virtual environment.

I want to hear things from experience devs.

thank you.

4 Upvotes

43 comments sorted by

View all comments

1

u/Confident_Hyena2506 8d ago

If you don't have any python then you can't run any python.

And you will need lots of different versions of python for different projects - virtual env is just a way to organise them.

1

u/xaomaw 8d ago

If you don't have any python then you can't run any python.

I downvoted because of this.

If you install python, it is usually installed in Program Files or in AppData.

In the first place, this has 0% to do with virtual environments. You don't need virtual environments to run python at all.

1

u/Confident_Hyena2506 8d ago

Well if you didn't install python then you wouldn't have it - are you confused?

1

u/SharkSymphony 7d ago

Virtual environments don't manage installations of Python itself, only Python packages. We use other tools like pyenv (unfortunate naming collision!), uv, or pymanager to manage multiple installations of Python when we need them. (Or containers or VMs.)

1

u/Confident_Hyena2506 7d ago

All of those things are virtual environments, you are getting hung up on terminology.

There is a specific thing called venv yes - and many others.

On windows people have limited options tho. You missed out on "conda" as well - which is also better.

1

u/SharkSymphony 7d ago

No, one of these things is almost always what we mean when we say "virtual environment" in the Python community.

But you're right – conda is another option. I disagree that it's better, but I recognize its use in the Python data community.

1

u/Confident_Hyena2506 7d ago

It is better - the part you miss is that it's a general purpose thing and not a simple python thing. As in you can use it to setup your c++ env and other things.

On windows this is especially useful, because all the usual stuff like containers are useless on windows.