You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04/20.04安装python3-serial后miniterm.py未加入PATH的问题求助

Ubuntu 18.04/20.04安装python3-serial后miniterm.py未加入PATH的问题求助

Hey there, sorry you're stuck with this miniterm.py PATH issue—this is a pretty common quirk with how pyserial is packaged on Ubuntu, so let's work through it step by step:

  • First, track down where miniterm.py is actually installed
    The apt package python3-serial doesn't put miniterm.py directly in /usr/bin or /usr/local/bin like you might expect. It's stored in Python's site-packages directory instead. Run this command to locate it quickly (it skips permission error messages to keep output clean):

    sudo find / -name miniterm.py 2>/dev/null
    

    For the apt-installed version, you'll probably find it at /usr/lib/python3/dist-packages/serial/tools/miniterm.py. If you used pip in a virtual environment, it'll be inside that env's site-packages folder.

  • Two simple ways to make it accessible without typing the full path

    1. Use Python's module execution (most reliable)
      You don't need the file in your PATH at all—just run it directly via the pyserial module. This works no matter where the package is installed (system-wide or in a virtual env):

      python3 -m serial.tools.miniterm
      

      This is actually the recommended way to run many Python command-line tools, since it bypasses PATH issues entirely.

    2. Create a symbolic link to a PATH directory
      If you prefer typing just miniterm.py, make a soft link to a folder that's already in your PATH (like ~/.local/bin, which doesn't require sudo privileges):

      ln -s /usr/lib/python3/dist-packages/serial/tools/miniterm.py ~/.local/bin/miniterm.py
      

      Double-check ~/.local/bin is in your PATH with echo $PATH. If it's missing, add this line to your ~/.bashrc file:

      export PATH="$HOME/.local/bin:$PATH"
      

      Then reload your shell settings with source ~/.bashrc.

  • If miniterm.py is nowhere to be found
    Your installation might be corrupted. Try re-installing the apt package from scratch:

    sudo apt purge python3-serial && sudo apt autoremove && sudo apt install -y python3-serial
    

    For virtual environments, make sure you activate the env first, then re-install pyserial:

    source your-env/bin/activate
    pip uninstall pyserial
    pip install pyserial
    

    Run the find command again after this to locate the file.

备注:内容来源于stack exchange,提问作者Bogdan Prădatu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 14:53:11