I want to cite and reference all my used Python libraries which i used for my masterthesis.
It is usually enough to cite just the package (not individual libraries), unless there are special circumstances.
Libraries / datasets with a science background (rule of thumb: papers were published introducing the library and/or it is part of an academic project) usually have somewhere on their websites some information about how it should be cited. In those cases, you should obviously use that. Example for MatPower - a Matlab package for power systems analysis (emphasis mine):
Please see the LICENSE file for the details. But here is the summary
Beginning with version 5.1, the code in MATPOWER is distributed under
the 3-clause BSD license. MATPOWER is distributed in the hope that it
will be useful, but WITHOUT ANY WARRANTY. While not required by the
terms of the license, we do request that publications derived from the
use of MATPOWER explicitly acknowledge that fact by citing .
Additionally, we request that publications derived from the use of the
MATPOWER Optimal Scheduling Tool (MOST), explicitly acknowledge that
fact by citing  as well as .
-  R. D. Zimmerman, C. E. Murillo-Sánchez, and R. J. Thomas, "MATPOWER: Steady-State Operations, Planning and Analysis Tools for Power Systems Research and Education," Power Systems, IEEE Transactions on, vol. 26, no. 1, pp. 12-19, Feb. 2011.
-  C. E. Murillo-Sánchez, R. D. Zimmerman, C. L. Anderson, and R. J. Thomas, "Secure Planning and Operations of Systems with
Stochastic Sources, Energy Storage and Active Demand," Smart Grid,
IEEE Transactions on, vol. 4, no. 4, pp. 2220-2229, Dec. 2013.
For libraries with no such information, it is usually enough to put the link, or permalink if at all possible, to the website as a reference.
You should also check the institution's (or publishing venues's) reference guidelines, there should be something about citing online resources.