简体   繁体   中英

Getting error in VS code when trying to create virtual environment on windows

I am trying to create a virtual environment in VS code to make a flask app. After I run the command in the VS code terminal pip install virtualenv everything downloads find but I get the error WARNING: The script virtualenv.exe is installed in

C:\Users\NAME\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Then when I try to create my virtual environment by using this command virtualenv env I get the error

virtualenv : The term 'virtualenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Are you using Python from the Windows Store? You'd better avoid it.

You can download the python from the official site .

And then create the virtual environment through venv .

You can refer to official docs for more details of the virtual environment created.

This is happening because the directory (as mentioned by you)

C:\Users\NAME\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH.

is not added to your PATH

Consider this link Add to the PATH on Windows 10 and add the directory to the PATH. It's gonna solve your problem. The same issue happened to me it solve it as said above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM