How to Deactivate Python Virtual Environment in Microsoft Windows

Posted on

Introduction

This article will show how to deactivate python virtual environment. The process for deactivating exist in Microsoft Windows. It is actually has a connection with the previous article. That article is an article with the title of ‘How to Activate Python Virtual Environment in Microsoft Windows’. Furthermore, that article exist in this link. Actually, that article is informing about how to activate python virtual environment in Microsoft Windows. So, this article is the opposite of it. After activating the python virtual environment, there is a need to deactivate it back.

Deactivate Python Virtual Environment in Microsoft Windows

In this context, deactivating a python virtual environment in Microsoft Windows is actually a simple task. Just execute the correct command in the command line. Executing the correct command in the command line will directly deactivate the python virtual environment. Before moving on for deactivating the python virtual environment, the following is the actual process for activating it :

  1. Access the folder where the python virtual environment exist. In this context, it is exist in ‘C:\programming\python\env

    C:\programming\python>cd env
    
    C:\programming\python\env>cd Scripts
    
    C:\programming\python\env\Scripts>activate
    
    (env) C:\programming\python\env\Scripts>
    
  2. Next, do the following to check the content of the folder of the Scripts :

    (env) C:\programming\python\env\Scripts>dir
    Volume in drive C is Windows
    Volume Serial Number is E003-3593
    
    Directory of C:\programming\python\env\Scripts
    
    09/18/2021 08:31 PM <DIR> .
    09/18/2021 08:31 PM <DIR> ..
    09/18/2021 08:31 PM 2,335 activate
    09/18/2021 08:31 PM 1,091 activate.bat
    09/18/2021 08:31 PM 3,201 activate.fish
    09/18/2021 08:31 PM 1,815 activate.ps1
    09/18/2021 08:31 PM 1,238 activate.xsh
    09/18/2021 08:31 PM 1,225 activate_this.py
    09/18/2021 08:31 PM 529 deactivate.bat
    09/18/2021 08:31 PM 106,397 easy_install-3.8.exe
    09/18/2021 08:31 PM 106,397 easy_install.exe
    09/18/2021 08:31 PM 106,397 easy_install3.exe
    09/18/2021 08:31 PM 3,381,792 libcrypto-1_1.dll
    09/18/2021 08:31 PM 32,792 libffi-7.dll
    09/18/2021 08:31 PM 686,112 libssl-1_1.dll
    09/18/2021 08:31 PM 106,388 pip-3.8.exe
    09/18/2021 08:31 PM 106,388 pip.exe
    09/18/2021 08:31 PM 106,388 pip3.8.exe
    09/18/2021 08:31 PM 106,388 pip3.exe
    09/18/2021 08:31 PM 25 pydoc.bat
    09/18/2021 08:31 PM 189,512 pyexpat.pyd
    09/18/2021 08:31 PM 99,912 python.exe
    09/18/2021 08:31 PM 58,952 python3.dll
    09/18/2021 08:31 PM 4,195,912 python38.dll
    09/18/2021 08:31 PM 98,376 pythonw.exe
    09/18/2021 08:31 PM 26,696 select.pyd
    09/18/2021 08:31 PM 1,272,904 sqlite3.dll
    09/18/2021 08:31 PM 1,705,120 tcl86t.dll
    09/18/2021 08:31 PM 1,468,064 tk86t.dll
    09/18/2021 08:31 PM 1,096,264 unicodedata.pyd
    09/18/2021 08:31 PM 89,752 vcruntime140.dll
    09/18/2021 08:31 PM 106,375 wheel-3.8.exe
    09/18/2021 08:31 PM 106,375 wheel.exe
    09/18/2021 08:31 PM 106,375 wheel3.exe
    09/18/2021 08:31 PM 28,744 winsound.pyd
    09/18/2021 08:31 PM 63,560 _asyncio.pyd
    09/18/2021 08:31 PM 84,040 _bz2.pyd
    09/18/2021 08:31 PM 123,976 _ctypes.pyd
    09/18/2021 08:31 PM 33,352 _ctypes_test.pyd
    09/18/2021 08:31 PM 269,384 _decimal.pyd
    09/18/2021 08:31 PM 176,712 _elementtree.pyd
    09/18/2021 08:31 PM 45,640 _hashlib.pyd
    09/18/2021 08:31 PM 252,488 _lzma.pyd
    09/18/2021 08:31 PM 38,984 _msi.pyd
    09/18/2021 08:31 PM 29,256 _multiprocessing.pyd
    09/18/2021 08:31 PM 45,128 _overlapped.pyd
    09/18/2021 08:31 PM 28,232 _queue.pyd
    09/18/2021 08:31 PM 78,920 _socket.pyd
    09/18/2021 08:31 PM 87,624 _sqlite3.pyd
    09/18/2021 08:31 PM 118,856 _ssl.pyd
    09/18/2021 08:31 PM 52,808 _testbuffer.pyd
    09/18/2021 08:31 PM 112,200 _testcapi.pyd
    09/18/2021 08:31 PM 24,136 _testconsole.pyd
    09/18/2021 08:31 PM 22,600 _testimportmultiple.pyd
    09/18/2021 08:31 PM 31,816 _testmultiphase.pyd
    09/18/2021 08:31 PM 64,584 _tkinter.pyd
    54 File(s) 17,290,527 bytes
    2 Dir(s) 1,741,246,464 bytes free
    
  3. So, there are lots of files inside the Scripts folder. There is a file with the name of ‘activate.bat’ inside of the folder. That file is a file which is very useful to activate the python virtual environment. On the other hand, there is also another file with the name of ‘deactivate.bat’. It is actually a file for deactivating the python virtual environment. In other words, in order to deactivate it, just execute the following command :

    (envtest) C:\programming\python\env\Scripts>deactivate
    C:\programming\python\env\Scripts>
    

    Since the above process is a success, deactivating the python virtual environment is a success.

Leave a Reply