0

I created a venv and I want to use it in another file, but for some reason it says that:

"Python cannot be found"

I installed Python 3.9.2 on Windows 10 and created a venv that worked perfectly in a previous project. However, I created a new file in the same folder (inside my venv folder) and it's not working. How can I activate it?

I read about #!\path\to\venv\bin\activate (also \activate.bat and \python) but I don't have a bin folder, I replaced bin for Scripts, still not working. How can I solve this?

Side note: the first script runs without issue. Moreover, I installed Python in a folder called python39.

Thank you in advance!

TechGeek49
  • 476
  • 1
  • 7
  • 24
Amendo
  • 71
  • 10

1 Answers1

0

Each virtual environment has its own Python binary (which matches the version of the binary that was used to create this environment) and can have its own independent set of installed Python packages in its site directories.

(from https://docs.python.org/3.9/library/venv.html)

So at the moment of environment creation, the python binary is copied. You can't just copy the venv from one place to another and expect the corresponding binary to work.

Niloct
  • 9,491
  • 3
  • 44
  • 57
  • ok, so according to this, each project should have its own virtual environment? there's no workaround? i don't wanna be installing gspread and selenium every time I create a new project (for cleareance, I'm learning both, son in my case project = lesson) – Amendo Mar 12 '21 at 01:35
  • 1
    See if this question helps you better: https://stackoverflow.com/questions/7438681/how-to-duplicate-virtualenv – Niloct Mar 12 '21 at 01:54