Introduction
This is an article where the main content is to show how to create a python virtual environment. The process for creating a python virtual environment is using a specific tool. In this context, it is using an Anaconda Command Prompt. Furthermore, the process execution is in a Windows operating system.
Step to Create Python Virtual Environment
So, the process for creating a python virtual environment for further usage exist as follows :
-
First of all, just run the Anaconda Command Prompt as in the following image :
-
How to Create Python Virtual Environment from Anaconda in Microsoft Windows -
After the Anaconda Prompt appear, there will be an Anaconda command prompt in it as follows :
(base) C:\Users\Personal> cd C:\training\django-training (base) C:\training\django-training>
-
Following after, check the virtualenv library whether it exist or not. Either by trying to install it or by searching it further as follows :
(base) C:\training\django-training>pip install virtualenv Requirement already satisfied: virtualenv in c:\anaconda3\lib\site-packages (20.14.1) Requirement already satisfied: distlib<1,>=0.3.1 in c:\anaconda3\lib\site-packages (from virtualenv) (0.3.4) Requirement already satisfied: platformdirs<3,>=2 in c:\anaconda3\lib\site-packages (from virtualenv) (2.5.2) Requirement already satisfied: filelock<4,>=3.2 in c:\anaconda3\lib\site-packages (from virtualenv) (3.3.1) Requirement already satisfied: six<2,>=1.9.0 in c:\anaconda3\lib\site-packages (from virtualenv) (1.16.0) (base) C:\training\django-training>
Apparently, it has already exist upon executing the above command for installing ‘virtualenv’ library. Furthermore, checking the ‘virtualenv’ is also possible by executing the command for listing the available library as follows :
(base) C:\training\django-training>pip list Package Version ---------------------------------- -------------------- ... virtualenv 20.14.1 ... (base) C:\training\django-training>
As it appears in the above command execution of ‘pip list’, the virtualenv library is also exist.
-
Next, since the ‘virtualenv’ library is available, execute the following command to create the python virtual environment :
(base) C:\training\django-training>python -m virtualenv env created virtual environment CPython3.9.7.final.0-64 in 4552ms creator CPython3Windows(dest=C:\training\django-training\env, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\Personal\AppData\Local\pypa\virtualenv) added seed packages: pip==22.0.4, setuptools==62.1.0, wheel==0.37.1 activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator (base) C:\training\django-training>
-
Continue on the previous step, just check the availability of the env folder which is the result of the above command. That ‘env’ folder is the python virtual environment’s directory which exist as follows :
(base) C:\training\django-training>dir Volume in drive C is Windows-SSD Volume Serial Number is CA30-19A4 Directory of C:\training\django-training 05/03/2022 10:32 AM <DIR> . 04/23/2022 10:28 PM <DIR> .. 05/03/2022 10:32 AM <DIR> env 0 File(s) 0 bytes 3 Dir(s) 219,817,283,584 bytes free (base) C:\training\django-training>
-
For the next step, just get in to the ‘env’ and check the content of the python virtual environment folder as follows :
(base) C:\training\django-training>cd env (base) C:\training\django-training\env>dir Volume in drive C is Windows-SSD Volume Serial Number is CA30-19A4 Directory of C:\training\django-training\env 05/03/2022 10:32 AM <DIR> . 05/03/2022 10:32 AM <DIR> .. 05/03/2022 10:32 AM 42 .gitignore 05/03/2022 10:32 AM <DIR> Lib 05/03/2022 10:33 AM 241 pyvenv.cfg 05/03/2022 10:33 AM <DIR> Scripts 2 File(s) 283 bytes 4 Dir(s) 219,816,923,136 bytes free
- Actually, the script for activating the python virtual environment exist in folder ‘Scripts’. In that case, just access the ‘Scripts’ folder as follows :
(base) C:\training\django-training\env>cd Scripts (base) C:\training\django-training\env\Scripts>dir Volume in drive C is Windows-SSD Volume Serial Number is CA30-19A4 Directory of C:\training\django-training\env\Scripts 05/03/2022 10:33 AM <DIR> . 05/03/2022 10:32 AM <DIR> .. 05/03/2022 10:33 AM 2,167 activate 05/03/2022 10:33 AM 1,007 activate.bat 05/03/2022 10:33 AM 3,044 activate.fish 05/03/2022 10:33 AM 2,607 activate.nu 05/03/2022 10:33 AM 1,758 activate.ps1 05/03/2022 10:33 AM 1,193 activate_this.py 05/03/2022 10:32 AM 19,208 api-ms-win-core-console-l1-1-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-datetime-l1-1-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-debug-l1-1-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-errorhandling-l1-1-0.dll 05/03/2022 10:32 AM 22,280 api-ms-win-core-file-l1-1-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-file-l1-2-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-file-l2-1-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-handle-l1-1-0.dll 05/03/2022 10:32 AM 19,208 api-ms-win-core-heap-l1-1-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-interlocked-l1-1-0.dll 05/03/2022 10:32 AM 19,720 api-ms-win-core-libraryloader-l1-1-0.dll 05/03/2022 10:32 AM 21,256 api-ms-win-core-localization-l1-2-0.dll 05/03/2022 10:32 AM 19,208 api-ms-win-core-memory-l1-1-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-namedpipe-l1-1-0.dll 05/03/2022 10:32 AM 19,720 api-ms-win-core-processenvironment-l1-1-0.dll 05/03/2022 10:32 AM 20,744 api-ms-win-core-processthreads-l1-1-0.dll 05/03/2022 10:32 AM 19,208 api-ms-win-core-processthreads-l1-1-1.dll 05/03/2022 10:32 AM 18,184 api-ms-win-core-profile-l1-1-0.dll 05/03/2022 10:32 AM 19,208 api-ms-win-core-rtlsupport-l1-1-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-string-l1-1-0.dll 05/03/2022 10:32 AM 20,744 api-ms-win-core-synch-l1-1-0.dll 05/03/2022 10:32 AM 19,208 api-ms-win-core-synch-l1-2-0.dll 05/03/2022 10:32 AM 19,720 api-ms-win-core-sysinfo-l1-1-0.dll 05/03/2022 10:32 AM 19,208 api-ms-win-core-timezone-l1-1-0.dll 05/03/2022 10:32 AM 18,696 api-ms-win-core-util-l1-1-0.dll 05/03/2022 10:32 AM 19,720 api-ms-win-crt-conio-l1-1-0.dll 05/03/2022 10:32 AM 22,792 api-ms-win-crt-convert-l1-1-0.dll 05/03/2022 10:32 AM 19,208 api-ms-win-crt-environment-l1-1-0.dll 05/03/2022 10:32 AM 20,744 api-ms-win-crt-filesystem-l1-1-0.dll 05/03/2022 10:32 AM 19,720 api-ms-win-crt-heap-l1-1-0.dll 05/03/2022 10:32 AM 19,208 api-ms-win-crt-locale-l1-1-0.dll 05/03/2022 10:32 AM 27,912 api-ms-win-crt-math-l1-1-0.dll 05/03/2022 10:32 AM 26,888 api-ms-win-crt-multibyte-l1-1-0.dll 05/03/2022 10:32 AM 71,432 api-ms-win-crt-private-l1-1-0.dll 05/03/2022 10:32 AM 19,720 api-ms-win-crt-process-l1-1-0.dll 05/03/2022 10:32 AM 23,304 api-ms-win-crt-runtime-l1-1-0.dll 05/03/2022 10:32 AM 24,840 api-ms-win-crt-stdio-l1-1-0.dll 05/03/2022 10:32 AM 24,840 api-ms-win-crt-string-l1-1-0.dll 05/03/2022 10:32 AM 21,256 api-ms-win-crt-time-l1-1-0.dll 05/03/2022 10:32 AM 19,208 api-ms-win-crt-utility-l1-1-0.dll 05/03/2022 10:32 AM 317,224 concrt140.dll 05/03/2022 10:33 AM 510 deactivate.bat 05/03/2022 10:33 AM 682 deactivate.nu 05/03/2022 10:32 AM 35,064 libffi-8.dll 05/03/2022 10:32 AM 590,632 msvcp140.dll 05/03/2022 10:32 AM 31,528 msvcp140_1.dll 05/03/2022 10:32 AM 193,832 msvcp140_2.dll 05/03/2022 10:32 AM 27,936 msvcp140_codecvt_ids.dll 05/03/2022 10:33 AM 106,886 pip-3.9.exe 05/03/2022 10:33 AM 106,886 pip.exe 05/03/2022 10:33 AM 106,886 pip3.9.exe 05/03/2022 10:33 AM 106,886 pip3.exe 05/03/2022 10:33 AM 24 pydoc.bat 05/03/2022 10:32 AM 194,048 pyexpat.pyd 05/03/2022 10:32 AM 95,232 python.exe 05/03/2022 10:32 AM 52,224 python3.dll 05/03/2022 10:32 AM 4,451,840 python39.dll 05/03/2022 10:32 AM 93,696 pythonw.exe 05/03/2022 10:32 AM 20,992 select.pyd 05/03/2022 10:32 AM 1,705,120 tcl86t.dll 05/03/2022 10:32 AM 1,468,064 tk86t.dll 05/03/2022 10:32 AM 1,016,584 ucrtbase.dll 05/03/2022 10:32 AM 1,113,088 unicodedata.pyd 05/03/2022 10:32 AM 337,696 vccorlib140.dll 05/03/2022 10:32 AM 184,616 vcomp140.dll 05/03/2022 10:32 AM 101,672 vcruntime140.dll 05/03/2022 10:32 AM 44,328 vcruntime140_1.dll 05/03/2022 10:32 AM 106,873 wheel-3.9.exe 05/03/2022 10:32 AM 106,873 wheel.exe 05/03/2022 10:32 AM 106,873 wheel3.9.exe 05/03/2022 10:32 AM 106,873 wheel3.exe 05/03/2022 10:32 AM 21,504 winsound.pyd 05/03/2022 10:32 AM 298,496 xlwings32-0.24.9.dll 05/03/2022 10:32 AM 371,200 xlwings64-0.24.9.dll 05/03/2022 10:32 AM 56,832 _asyncio.pyd 05/03/2022 10:32 AM 76,800 _bz2.pyd 05/03/2022 10:32 AM 129,536 _ctypes.pyd 05/03/2022 10:32 AM 25,600 _ctypes_test.pyd 05/03/2022 10:32 AM 263,680 _decimal.pyd 05/03/2022 10:32 AM 178,176 _elementtree.pyd 05/03/2022 10:32 AM 56,320 _hashlib.pyd 05/03/2022 10:32 AM 155,136 _lzma.pyd 05/03/2022 10:32 AM 31,744 _msi.pyd 05/03/2022 10:32 AM 22,016 _multiprocessing.pyd 05/03/2022 10:32 AM 37,888 _overlapped.pyd 05/03/2022 10:32 AM 21,504 _queue.pyd 05/03/2022 10:32 AM 72,704 _socket.pyd 05/03/2022 10:32 AM 82,432 _sqlite3.pyd 05/03/2022 10:32 AM 145,920 _ssl.pyd 05/03/2022 10:32 AM 45,568 _testbuffer.pyd 05/03/2022 10:32 AM 120,320 _testcapi.pyd 05/03/2022 10:32 AM 16,896 _testconsole.pyd 05/03/2022 10:32 AM 15,360 _testimportmultiple.pyd 05/03/2022 10:32 AM 19,456 _testinternalcapi.pyd 05/03/2022 10:32 AM 26,112 _testmultiphase.pyd 05/03/2022 10:32 AM 57,344 _tkinter.pyd 05/03/2022 10:32 AM 15,360 _uuid.pyd 05/03/2022 10:32 AM 39,424 _zoneinfo.pyd 104 File(s) 16,211,348 bytes 2 Dir(s) 219,815,710,720 bytes free (base) C:\training\django-training\env\Scripts>
As exist in the above output command, the process to create python virtual environment is a success and it also finished.
One thought on “How to Create Python Virtual Environment from Anaconda in Microsoft Windows”