user2332713
user2332713

Reputation: 21

I am trying to create a virtual environment in python but getting error "No Such File Or Directory"

Creating virtual environment in Windows

C:\Python>mkvirtualenv py1 C:\Users\176226\Envs is not a directory, creating FileNotFoundError: [Errno 2] No such file or directory: 'c:\users\176226\anaconda3\Lib\venv\scripts\nt\python.exe'

This path exists: c:\users\176226\anaconda3\Lib\venv\scripts\nt\ And I do have python installed as well Can someone please help

Upvotes: 0

Views: 8793

Answers (2)

Surya Teja
Surya Teja

Reputation: 1478

c:\users\176226\anaconda3\Lib\venv\scripts\nt\python.exe

The above path is of Python executable not the environment source file.

Assuming that you are using Python 3, you can follow the below steps to create and activate Python environment:

To create environment: python -m venv path/to/virtualenv

Example:

python -m venv .venv

The above command creates Python environment in current directory.

To activate the environment created in the previous step:

.venv\Scripts\activate

activate is the source script which activates the environment.

Upvotes: 3

Simplecode
Simplecode

Reputation: 589

Pls. refer https://www.geeksforgeeks.org/creating-python-virtual-environment-windows-linux/ Windows section. If python is installed in your system, then pip comes in handy.

Upvotes: 0

Related Questions