Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions _episodes/12-virtual-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,17 @@ From <a href="https://xkcd.com/1987/" target="_blank">XKCD</a> (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:

Expand Down
14 changes: 12 additions & 2 deletions _extras/common-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down