Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do "export PYTHONPATH=." on windows powershell?

On a Linux session I can set an environment variable like

export PYTHONPATH=.

How to do that on a windows Powershell? I found THIS and tried

 [Environment]::SetEnvironmentVariable PYTHONPATH=.

and

$env PYTHONPATH=.

but neither did not work. In both cases I got an error UnexpectedToken.

like image 710
Alex Avatar asked Sep 08 '26 12:09

Alex


1 Answers

$env:PYTHONPATH = $pwd

You forgot a colon in the last version. Also the . doesn't work here, but you can use the built-in variable $pwd (current directory).

I find $env:NAME the easiest way to get environment variables in Powershell. It also follows the Microsoft documentation: about_Environment_Variables.

like image 154
DeLacey Avatar answered Sep 10 '26 05:09

DeLacey