Get information about the current system, Python, and Python packages.
-
Use
pip
to install directly from GitHub:pip install git+https://github.com/artemmavrin/py_info.git
-
Alternatively, clone the repo and install manually:
git clone https://github.com/artemmavrin/py_info.git cd py_info make install
Either method will install install the py_info
Python package in your current
environment and create a script called py_info
on your system path.
From a terminal, run the py_info
script:
$ py_info
System
======
Platform: Linux-4.9.184-linuxkit-x86_64-with-debian-10.2
Hostname: 52a9020e146b
Machine Type: x86_64
Processor: ???
Byte Order: little-endian
Working Directory: /home/py_info
Path: /usr/local/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
Python
======
Version: 3.7.6 (default, Feb 2 2020, 09:00:14)
[GCC 8.3.0]
Executable: /usr/local/bin/python
Implementation: CPython
Python Path: /usr/local/lib/python37.zip
/usr/local/lib/python3.7
/usr/local/lib/python3.7/lib-dynload
/usr/local/lib/python3.7/site-packages
Packages
========
matplotlib: 3.1.3
numpy: 1.18.1
pandas: 1.0.1
scipy: 1.4.1
sklearn: 0.22.1
tensorflow: 2.1.0
Run with the -h
or --help
flag to view usage instructions:
$ py_info --help
usage: py_info [-h] [package [package ...]]
Get information about Python and the system.
positional arguments:
package One or more Python packages. (default: ['matplotlib', 'numpy', 'pandas', 'scipy', 'sklearn', 'tensorflow'])
optional arguments:
-h, --help show this help message and exit
Specify which packages you care about by listing them as command line arguments:
$ py_info numpy tensorflow
System
======
...
Packages
========
numpy: 1.18.1
tensorflow: None
From a terminal, run python -m py_info
:
$ python -m py_info
System
======
...
You may also specify command line package names here.
The module py_info
can be imported and called, e.g., from the Python
interpreter:
>>> import py_info
>>> py_info()
System
======
...
>>> py_info('sklearn', 'scipy') # Specify packages as positional arguments
System
======
...
Packages
========
sklearn: 0.22.1
scipy: 1.4.1
>>> py_info(['sklearn', 'scipy']) # Specify a list of packages
System
======
...
Packages
========
sklearn: 0.22.1
scipy: 1.4.1
The output shown above was generated in a Docker container based on the Dockerfile in this repo. To reproduce it, ensure that Docker is installed, and run
make image
make run