代码之家  ›  专栏  ›  技术社区  ›  Abrahim

如何在Windows 10 VS Code或PyCharm终端中查看环境变量?

  •  0
  • Abrahim  · 技术社区  · 2 年前

    我在Windows 10上尝试用Python编写代码,并将变量存储到环境变量中。

    当我输入'set example=123'时,命令不会出现任何问题,但当我自己输入'set'以便查看存储的内容时,我得到以下结果:

    PS C:\Users\Abrahim\Desktop\New file> set
    
    cmdlet Set-Variable at command pipeline position 1
    Supply values for the following parameters:
    Name[0]:
    Set-Variable : Cannot bind argument to parameter 'Name' because it is an empty array.
    At line:1 char:1
    + set
    + ~~~
        + CategoryInfo          : InvalidData: (:) [Set-Variable], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyArrayNotAllowed,Microsoft.PowerShell.Commands.SetVariableCommand
    

    我不确定这是否相关,但我看到一些地方建议我必须建立一个环境。如果我只是在工作过程中需要它,我需要设置它吗?

    我尝试了所有的大写字母,以防“SET”、“env”和“env”。

    PS C:\Users\Abrahim\Desktop\New file> SET
    
    cmdlet Set-Variable at command pipeline position 1
    Supply values for the following parameters:
    Name[0]:
    Set-Variable : Cannot bind argument to parameter 'Name' because it is an empty array.
    At line:1 char:1
    + SET
    + ~~~
        + CategoryInfo          : InvalidData: (:) [Set-Variable], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyArrayNotAllowed,Microsoft.PowerShell.Commands.SetVariableCommand
    
    
    PS C:\Users\Abrahim\Desktop\New file> env
    env : The term 'env' 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.
    At line:1 char:1
    + env
    + ~~~
        + CategoryInfo          : ObjectNotFound: (env:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    
    
    PS C:\Users\Abrahim\Desktop\New file> ENV
    ENV : The term 'ENV' 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.
    At line:1 char:1
    + ENV
    + ~~~
        + CategoryInfo          : ObjectNotFound: (ENV:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    
    
    1 回复  |  直到 2 年前
        1
  •  0
  •   Robinson Batista Madrigal    2 年前

    转到windows选项卡并键入 CMD 然后在命令提示符中键入 set 然后进去。