9

I installed virtualenv and I created a virtual environment inside my directory. Everything is OK, but I can't activate it. When I run:

source /bin/activate

it says:

already: command not found

Screenshot:

img_virtualenv

3
  • 1
    Hi and welcome. Please do not have pictures of text, always include the text in the body of the question so everyone can see it. The error is clear in the directory you are running the command from it does not exist.
    – David
    Mar 31, 2021 at 13:23
  • but i run this command almost in every directory...it is only working in home/ directory....but not working in side a folder which is also in home Mar 31, 2021 at 14:06
  • A virtualenv only works in a specific directory. You get to specify the directory when you create the venv. This does not seem like an Ubuntu-related question. This seems like a how-do-I-use-python-venv question. There are some good examples at docs.python.org/3/library/venv.html.
    – user535733
    Mar 31, 2021 at 15:52

2 Answers 2

13

You need to install python3-venv:

sudo apt install python3-venv

Then:

python3 -m venv vvv
source vvv/bin/activate
1
  • 3
    the last line was the answer I was looking for
    – mr.loop
    Jun 17, 2022 at 11:06
0

if your virtual environment name is "venv", you can use below command to switch there:

source venv/bin/activate

enter image description here

referance : https://www.youtube.com/watch?v=2W_YE0fZs88

1
  • 3
    This seems like a duplicate of another answer to this question. How is this answer different?
    – user535733
    Feb 5 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .