Why can't I activate venv after creating an environment?

Question:

I am trying to use venv for my own existing project for the first time. I am not sure how to activate an environment. (This is Ubuntu)

$ ~/scripts/Alloy_Defender$ python3 -m venv /home/tech/scripts/Alloy_Defender

$ ~/scripts/Alloy_Defender$ venv/bin/activate
bash: venv/bin/activate: No such file or directory

$ ~/scripts/Alloy_Defender$ .venv/bin/activate
bash: .venv/bin/activate: No such file or directory

$ ~/scripts/Alloy_Defender$ ls
AA_start.py  auths  bin  database  functions  include  lib  lib64  
main.py  psutiltest.py  __pycache__  pyvenv.cfg  searchonetest.py  
settings  share  spamtest.py  test.py  webapi  wsgi.py

$ ~/scripts/Alloy_Defender$ /bin/activate
bash: /bin/activate: No such file or directory

$ ~/scripts/Alloy_Defender$ bin/activate
bash: bin/activate: Permission denied

$ ~/scripts/Alloy_Defender$ sudo bin/activate
[sudo] password for tech: 

sudo: bin/activate: command not found
$ ~/scripts/Alloy_Defender$ 

I used the python readthedocs.io page to find out how to do this. Maybe I am interpreting it wrong? https://python.readthedocs.io/fr/latest/library/venv.html
enter image description here

Asked By: user16660683

||

Answers:

It should be:

source env_pth/bin/activate

OR

. env_pth/bin/activate
Answered By: Sabil
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.