You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows命令行替代Linux/Unix下export命令的机器学习环境搭建咨询

Windows Equivalent for Linux/Unix ML Environment Setup Commands

Hey there! I get it—those Linux commands work smoothly, but when you're on Windows, you need to tweak things a bit. Let's break down the equivalent steps for both Command Prompt (CMD) and PowerShell, since those are the most common shells you'll use on Windows.

Command Prompt (CMD)

Temporary Environment Variable (only active in current CMD window)

  • Set the ML_PATH variable:
    set ML_PATH=%USERPROFILE%\ml
    
  • Create the directory (the -p flag in Linux means create parent directories if needed, and mkdir in CMD handles this automatically):
    mkdir %ML_PATH%
    
    You can also use md %ML_PATH% as a shorter alternative to mkdir.

Permanent Environment Variable (requires admin rights for system-wide setting)

  • For user-level (only applies to your account):
    setx ML_PATH "%USERPROFILE%\ml"
    
  • For system-level (applies to all users, needs admin privileges):
    setx ML_PATH "%USERPROFILE%\ml" /M
    

Note: After setting permanently, you'll need to close and reopen your CMD window (or restart your PC) for the changes to take effect.

PowerShell

Temporary Environment Variable (only active in current PowerShell session)

  • Set the ML_PATH variable:
    $env:ML_PATH = "$HOME/ml"
    
  • Create the directory with the same "create parent directories if missing" behavior as mkdir -p:
    New-Item -ItemType Directory -Path $env:ML_PATH -Force
    

Permanent Environment Variable

  • For user-level (no admin needed):
    [Environment]::SetEnvironmentVariable("ML_PATH", "$HOME/ml", "User")
    
  • For system-level (requires admin rights):
    [Environment]::SetEnvironmentVariable("ML_PATH", "$HOME/ml", "Machine")
    

Just like with CMD, you'll need to restart PowerShell or refresh your environment variables (you can run refreshenv if you have Chocolatey installed) to see the permanent changes.

内容的提问来源于stack exchange,提问作者Seth

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:11:51