安装lit后无法找到工具:执行python pip install lit成功但which lit无返回
lit not found after successful installation Hey there, let's work through why which lit returns nothing even though your install seemed to complete successfully! Here are the most common fixes:
1. First, find where lit was actually installed
Let's pinpoint the exact location of the installed lit files. Run this command:
python -m pip show lit
Look for the Location line in the output—this tells you where the package lives. The lit executable script will be in a bin (Linux/macOS) or Scripts (Windows) folder relative to this path. For example:
- On Linux/macOS, it’s often
~/.local/bin/litif you installed with user-level permissions - On Windows, it might be
%APPDATA%\Python\Python3X\Scripts\lit.exe
2. Check if the install directory is in your PATH
Your shell uses the PATH environment variable to find executable commands. Run echo $PATH (Linux/macOS) or echo %PATH% (Windows) to see if the bin/Scripts folder from step 1 is listed. If it’s missing:
- Quick temporary fix: Run
litusing its full absolute path (e.g.,~/.local/bin/liton Linux) - Permanent fix: Add the directory to your
PATH:- Linux/macOS: Add this line to your
~/.bashrc,~/.zshrc, or shell config file:
Then restart your shell or runexport PATH="$HOME/.local/bin:$PATH"source ~/.bashrcto apply changes. - Windows: Open System Properties → Advanced → Environment Variables, edit the user-level
Pathvariable, add theScriptsfolder path, and restart your terminal.
- Linux/macOS: Add this line to your
3. Run lit directly via Python (bypass PATH issues)
If you don’t want to tweak PATH right now, you can run lit using Python’s module runner—this works regardless of PATH settings:
python -m lit
4. Check for conflicting Python environments
If you have multiple Python versions (like python vs python3) or virtual environments, you might have installed lit in one environment but are checking another. Verify your pip and Python match:
pip --version python --version
If they don’t align, reinstall lit using the correct Python version (e.g., python3 -m pip install lit).
内容的提问来源于stack exchange,提问作者sean

