How to install a Python module
If Python was installed via Anaconda, there is a good chance that many of the modules discussed in this book have been installed together with Python. If Python was installed independently, users could use PyPi to install or update.
For example, we are interested in installing NumPy. On Windows, we have the following code:
If Python.exe
is on the path, we could open a DOS window first, then issue the preceding line. If Python.exe
is not on the path, we open a DOS window, then move to the location of the Python.exe
file; for an example, see the following screenshot:
For a Mac, we have the following codes. Sometimes, after running the preceding command, you might receive the following message asking for an update of PiP:
The command line to update pip
is given here:
See the result shown in the following screenshot:
To install NumPy independently, on Linux or OS X, we issue the following...