-2

The python version in my OS:

python3  --version
Python 3.9.2

Create a folder with venv.

python3  -m venv myproject

Now i can activate the virtual environment.

cd  myproject
~/myproject$ sh  bin/activate

I can't deactivate it,no deactivate script in the myproject.

tree -r  myproject | rg  deactivate
#Nothing as output

deactivate
bash: deactivate: command not found

How can deactivate the virtual environment then?

newview
  • 648
  • 6
  • 2
    You haven't actually activated it properly. You must do e.g. `source bin/activate`. The terminal wil show different prompt when the venv is activated. – ekhumoro Nov 12 '22 at 11:46
  • 2
    Does this answer your question? [How to activate virtualenv in Linux?](https://stackoverflow.com/questions/14604699/how-to-activate-virtualenv-in-linux). (NB: The deactivate command only works inside an active venv). – ekhumoro Nov 12 '22 at 11:49

2 Answers2

-1

try writing "venv name deactivate"

or you might've not even activated it properly

use:

    source bin/activate
Ryan
  • 14
  • 1
-1

Show all the steps:

debian@debian:~$ python3  -m venv myproject
debian@debian:~$ cd  myproject
debian@debian:~/myproject$ source  bin/activate
(myproject) debian@debian:~/myproject$ deactivate
debian@debian:~/myproject$ 

Done!

newview
  • 648
  • 6