- 1 year ago
pipenv shell Launching subshell in virtual environment… 'powershell.exe' is not recognized as an internal or external command, operable program or
If you encounter the error "'powershell.exe' is not recognized as an internal or external command, operable program or batch file" when trying to activate a virtual environment using pipenv shell
in PowerShell, it typically means that the powershell.exe
executable is not found in the system's PATH environment variable.
To resolve this issue, you can try the following solutions:
Add PowerShell to the PATH: Ensure that the directory containing the
powershell.exe
executable is included in the system's PATH environment variable. You can manually add the path to PowerShell by following these steps:- Open the Control Panel and go to "System and Security" -> "System" -> "Advanced system settings".
- Click on the "Environment Variables" button.
- In the "System variables" section, locate the "Path" variable and click on "Edit".
- Add the path to the directory containing
powershell.exe
(usuallyC:\Windows\System32\WindowsPowerShell\v1.0
) to the list of paths. Make sure to separate each path with a semicolon (;). - Click "OK" to save the changes.
Restart PowerShell: After modifying the PATH environment variable, close and reopen PowerShell to ensure the changes take effect. Try running
pipenv shell
again to activate the virtual environment.Use Command Prompt (CMD): If adding PowerShell to the PATH does not resolve the issue, you can try using Command Prompt (CMD) instead. Open Command Prompt, navigate to your project directory, and run
pipenv shell
to activate the virtual environment.
By following these steps, you should be able to resolve the error and activate the virtual environment using pipenv shell
in PowerShell.