Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

activate python venv in windows


# Add Python and Python Scripts to path
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
$PythonPath = "C:Python27"
$PythonScriptsPath = "C:Python27Scripts"

if ($env:Path -notlike "*$PythonPath*") {
    $env:Path = $env:Path + ";$PythonPath"
}

if ($env:Path -notlike "*$PythonScriptsPath*") {
    $env:Path = $env:Path + ";$PythonScriptsPath"
}

# Save to machine path
[Environment]::SetEnvironmentVariable( "Path", $env:Path, [System.EnvironmentVariableTarget]::Machine )

# Check machine path
[System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)

Source by coders911.org #
 
PREVIOUS NEXT
Tagged: #activate #python #venv #windows
ADD COMMENT
Topic
Name
2+4 =