How to Install mouse in Python

v0.7.1 CLI & Utilities MIT

Hook and simulate mouse events on Windows and Linux

Install pip install mouse

What is mouse?

Hook and simulate mouse events on Windows and Linux

Take full control of your mouse with this small Python library. Hook global events, register hotkeys, simulate mouse movement and clicks, and much more.

Huge thanks to Kirill Pavlov for donating the package name. If you are looking for the Cheddargetter.com client implementation, .

- Global event hook on all mice devices (captures events regardless of focus). - Listen and sends mouse events. - Works with Windows and Linux (requires sudo). - Pure Python, no C modules to be compiled. - Zero dependencies. Trivial to install and deploy, just copy the files. - Python 2 and 3. - Includes high level API (e.g. record and play. - Events automatically captured in separate thread, doesn't block main program. - Tested and documented.

Quick Start

Minimal example to get started with mouse:

import mouse

print(mouse.__version__)

Installation

pip (standard)

pip install mouse

Virtual environment (recommended)

python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install mouse

pip3

pip3 install mouse

conda

conda install -c conda-forge mouse

Poetry

poetry add mouse

Verify the Installation

After installing, confirm the package is available:

python -c "import mouse; print(mouse.__version__)"

If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.

Installation Errors

Common errors when installing mouse with pip.

ModuleNotFoundError: No module named 'mouse'

Cause: The package is not installed in the current Python environment.

Fix: Run pip install mouse. If using a virtual environment, ensure it is activated first.

ModuleNotFoundError: No module named 'mouse' (installed but still failing)

Cause: pip installed the package into a different Python than the one running your script.

Fix: Use python -m pip install mouse to install into the interpreter you are running.

ImportError: cannot import name 'X' from 'mouse'

Cause: The function or class does not exist in the installed version.

Fix: Check the version with pip show mouse and upgrade with pip install --upgrade mouse.

pip: command not found

Cause: pip is not in PATH or Python was not added to PATH during installation.

Fix: Try python -m pip install mouse. On macOS/Linux try pip3.

PermissionError: [Errno 13] Permission denied

Cause: No write access to the system Python package directory.

Fix: Use a virtual environment, or add --user: pip install --user mouse

SSL: CERTIFICATE_VERIFY_FAILED

Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.

Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org mouse

Recent Releases

VersionReleased
0.7.1 latest 2020-01-01
0.7.0 2017-08-15
0.6.1 2017-08-08
0.6.0 2017-08-04
0.5.0 2014-05-26

Full release history on PyPI →

Manage mouse

Upgrade to latest version

pip install --upgrade mouse

Install a specific version

pip install mouse==0.7.1

Uninstall

pip uninstall mouse

Check what is installed

pip show mouse

Last updated: 2026-04-11 • Data from PyPI