Py-cpuinfo is a pure Python library designed to retrieve detailed CPU information across various operating systems, including Linux, macOS, Windows, BSD, Solaris, Cygwin, Haiku, and BeagleBone. It functions without requiring any external programs or compilation beyond the standard OS provisions. The library is compatible with Python 3. The current stable version is 9.0.0, released in October 2022.
pip install py-cpuinfoVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to retrieve and print all available CPU information using the `get_cpu_info()` function.
Add `multiprocessing.freeze_support()` at the very beginning of your main script (before any other code) or ensure it's called if your freezing tool has a specific entry point for multiprocessing initialization. Refer to the `py-cpuinfo` GitHub issues or `multiprocessing` documentation for detailed integration with freezing tools.
Always prefer the parsed and standardized fields provided by `get_cpu_info()` for reliable data. Use 'Raw Fields' with extreme caution and implement robust validation if absolutely necessary.
Be aware that these specific frequency fields might not always be accurate. If precise clock speed measurement is critical, consider cross-referencing with other system tools or exploring alternative hardware-specific methods outside of this library.
The correct way to import the library after installing `py-cpuinfo` is `import cpuinfo`.
Safely access the dictionary key using the `.get()` method, for example: `cpuinfo.get_cpu_info().get('brand')`, which will return `None` if the key is not found instead of raising a KeyError.If your application uses multiprocessing and is frozen into an executable, add `from multiprocessing import freeze_support; if __name__ == '__main__': freeze_support()` at the very beginning of your main script file.
Try to upgrade `py-cpuinfo` to meet the dependency requirements using `pip install --upgrade py-cpuinfo` or explicitly install the required version: `pip install py-cpuinfo>=9.0.0`. If conflicts persist, consider creating a virtual environment or resolving broader dependency issues among your installed packages.
No dependency data recorded yet.