Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtual Environment Activation from Command Prompt Returns "The system cannot find the path specified" but Activates Venv Anyway?

I created a virtual environment in a Windows terminal using the standard:

python -m venv {venv name}

Everything works as far as I can tell, but when I change into the "Scripts" directory and run "activate" (or even ".\activate"), I get the message "The system cannot find the path specified." The resulting command prompt seems to indicate the venv is activated:

enter image description here

Using pip list indicates that I'm indeed in the virtual environment, so it seems the message is erroneous or referring to some other process going on behind the scenes.

The main reason I ask this question is because I've been trying to use the venv in VSCode but am unable to execute Python code in the Python Interactive window ("Stderr from shellexec, the system cannot find the path specified..." is a message I get followed by a reference to two Python files VSCode cannot seem to locate -- although they are indeed in the folder the message indicates).

I'm thinking this might have something to do with it, and have searched for days online and on SO for an answer to no avail.

like image 694
John Sukup Avatar asked Oct 14 '25 15:10

John Sukup


1 Answers

It looks like a registry reference to an old Anacoda installation was causing this issue. See here:

https://superuser.com/questions/727316/error-in-command-line-the-system-cannot-find-the-path-specified.

Essentially, clearing out the values for the "AutoRun" registry entry (which was referencing an Anaconda folder) cleared up both the original issue (i.e. "The system cannot find..." message when activating the venv from the CMD) and the ongoing issue of executing the Python Interactive session in a VSCode venv I created.

like image 93
John Sukup Avatar answered Oct 17 '25 05:10

John Sukup



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!