Reputation: 886
I have a powershell script which is meant to create a virtual environment with the following command:
py -3.6 -m venv --clear env
I have verified that I can do this when I run the above command in a powershell window, and the environment is created. However when I run the powershell script via an azure release pipeline, I get the following error:
python : The term 'python' 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.
I have verified that my user PATH environment variable has all the necessary paths:
C:\Python36\Scripts\;C:\Python36\;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Python36\Lib\site-packages\pywin32_system32;C:\Python36\Lib\site-packages\win32;C:\Automation\app\env\Scripts;C:\Python38;C:\Python38\Scripts;C:\Python38\Lib\site-packages\win32;C:\Python38\Lib\site-packages\pywin32_system32
Specs:
Python: 3.6.7 OS: Windows 10 Environment: Azure virtual machine.
Any help would be much appreciated.
Upvotes: 0
Views: 470
Reputation: 886
It runs out I hadn't added the paths to the system variables (in windows there are user environment variables and system environment variables, and pywin32 uses the system ones.
Upvotes: 0
Reputation: 41
There seems to be a change when the variable is injected into the pipeline.
Try using:
PYTHON -3_6 -M VENV --clear ENV
Environment variables: Environment variables are specific to the operating system you are using. They are injected into a pipeline in platform-specific ways. The format corresponds to how environment variables get formatted for your specific scripting platform.
On UNIX systems (macOS and Linux), environment variables have the format $NAME. On Windows, the format is %NAME% for batch and $env:NAME in PowerShell.
System and user-defined variables also get injected as environment variables for your platform. When variables are turned into environment variables, variable names become uppercase, and periods turn into underscores. For example, the variable name any.variable becomes the variable name $ANY_VARIABLE.
Upvotes: 2