Setup Python 3 & Git on Windows 10

Personally, I don’t like installing software using binary installers from the official site, because in the long run you have to deal with incompatibilities and a sparse development ecosystem.

On systems as OSX or Linux you have well known package-managers like brew and apt-get.

In the case of Windows there is Chocolatey.

Chocolatey

Installing

We open the PowerShell in Administrator Mode.

You can find it at: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

To install, we have to lower the security levels with:

Set-ExecutionPolicy Unrestricted

Let’s install it with:

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

Usage

You can install any program listed on chocolatey.org/packages with choco install.

Example:

choco install firefox

You can add a -y argument to install immediately:

choco install atom -y

Git

To install git it’s simply as:

choco install git.install

To start using it, we have to restart the PowerShell or refresh or $PATH environment variable with:

$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "User")

Now git command should work.

git help

Optional Git Setup

I recommend:

echo "Identify yourself"
git config --global user.name "NAME LASTNAME"
git config --global user.email [email protected]

echo "Don't ask again our user and password"
git config --global credential.helper wincred

echo "Colors!"
git config --global color.ui auto

Python 3

choco install python -y

pip

Pip comes with this installation, you can see it at C:\tools\python\Scripts.

Try, pip on your console, if it does not work, restart the PowerShell. If the problem continues, it’s probably because it is not added to the $PATH.

To do so:

[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\tools\python\Scripts\", "User")

comments powered by Disqus