diff --git a/_episodes/12-virtual-environments.md b/_episodes/12-virtual-environments.md index 2554d696c..4b81e5c69 100644 --- a/_episodes/12-virtual-environments.md +++ b/_episodes/12-virtual-environments.md @@ -196,6 +196,17 @@ From XKCD (Creative Commons Let us have a look at how we can create and manage virtual environments from the command line using `venv` and manage packages using `pip`. +> ## Making Sure You Can Invoke Python +> You can test your Python installation from the command line with: +> ~~~ +> $ python3 --version # on Mac/Linux +> $ python --version # on Windows — Windows installation comes with a python.exe file rather than a python3.exe file +> ~~~ +> {: .language-bash} +> If you are using Windows and invoking `python` command causes your Git Bash terminal to hang with no error message or output, you may +need to create an alias for the python executable `python.exe`, as explained in the [troubleshooting section](../common-issues/index.html#python-hangs-in-git-bash). +{: .prereq} + ### Creating Virtual Environments Using `venv` Creating a virtual environment with `venv` is done by executing the following command: diff --git a/_extras/common-issues.md b/_extras/common-issues.md index 82ebe7817..1bc208b5f 100644 --- a/_extras/common-issues.md +++ b/_extras/common-issues.md @@ -13,10 +13,20 @@ Hanging issues with trying to run Python 3 in Git Bash on Windows The solution appears to be to use `winpty` - a Windows software package providing an interface similar to a Unix pty-master for communicating with Windows command line tools. -Inside the shell type `alias python='winpty python.exe'`. +Inside the shell type: + +~~~ +$ alias python="winpty python.exe" +~~~ +{: .language-bash} + This alias will be valid for the duration of the shell session. For a more permanent solution, from the shell do: -`echo "alias python='winpty python.exe'" >> ~/.bashrc` +~~~ +$ echo "alias python='winpty python.exe'" >> ~/.bashrc +~~~ +{: .language-bash} + (and from there on remember to invoke Python as `python` or whatever command you aliased it to). Read more details on the issue at diff --git a/setup.md b/setup.md index c74c5524a..2cc49d08a 100644 --- a/setup.md +++ b/setup.md @@ -222,6 +222,10 @@ $ python3 --version # on Mac/Linux $ python --version # on Windows — Windows installation comes with a python.exe file rather than a python3.exe file ~~~ {: .language-bash} + +If you are using Windows and invoking `python` command causes your Git Bash terminal to hang with no error message or output, you may +need to create an alias for the python executable `python.exe`, as explained in the [troubleshooting section](../common-issues/index.html#python-hangs-in-git-bash). + If all is well with your installation, you should see something like: ~~~ Python 3.8.2