Temporary PYTHONPATH in Windows

后端 未结 4 2115
感情败类
感情败类 2021-01-13 04:25

How do I set, temporarily, the PYTHONPATH environment variable just before executing a Python script?

In *nix, I can do this:

$ PYTHONPATH=\'.\' pyth         


        
4条回答
  •  情歌与酒
    2021-01-13 05:13

    How temporarily? If you open a Windows console (cmd.exe), typing:

    set PYTHONPATH=.
    

    will change PYTHONPATH for that console only and any child processes created from it. Any python scripts run from this console will use the new PYTHONPATH value. Close the console and the change will be forgotten.

提交回复
热议问题