Follow us on Twitter ![]()
Question, remark ? Contact us at contact@myengineeringtools.com
Libraries are what makes Python cool : many developpers have already made so many functions ready to use. But how to install such a library to your local Python interpreter ? This step by step guide answers for a Windows environment.
The pre-requisite is to install Python. The Python installer can be retrieved from the official Python website where the latest version, but also older ones, are available.
The only important point to remember is to select "add to path" when installing.
Top 5 Most
Popular
1. Compressor
Power Calculation
2. Pump Power Calculation
3. Pipe Pressure
Drop Calculation
4. Fluid Velocity in pipes
5. Churchill Correlation
(friction factor)
| Are you interested in AI ? You can also check more resources about ChatGPT on MyEngineeringTools.com : ChatGPT : All reply output formats ChatGPT can doChatGPT : 10 useful prompts for Engineers |
Open a terminal : use the search function of Windows,
then type command, then click on prompt command. A terminal window opens.
Then type python in minuscule.
If the following shows, then you're good. If not, you need to review the installation of Python.
Python has a kind of app store for the different libaries available. It is called PyPi. Just go 1st to PyPi to get the exact name of the package you wish to install.
For example, you want to install numpy. Go to pypi.org and type numpy in the search box.
It is available, you can download it thanks to the install tool given by Python, named pip.
Python has a tool to download and install the library from PyPi.
If you are still in the python prompt, exit by typing exit()
To install a new library that you just need to type the following command :
python -m pip install namelibrary
Replace namelibrary by what you want to install, in our case, numpy
python -m pip install numpy
The new library is now available.
Note that it can in some cases be more complicated due to some dependencies in between libraries although pip is able to manage some and install other packages that may be needed by the library you wish to use, but for the most common ones it should be sufficient.