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

Ubuntu 18.04安装PyInstaller后执行命令提示‘pyinstaller: command not found’求助

Fixing "pyinstaller: command not found" on Ubuntu 18.04

Hey there! This is a super common issue when pip installs packages to a directory that isn’t in your system’s default PATH—let’s walk through fixing it step by step.

Step 1: Find where PyInstaller was installed

First, let’s confirm the exact location of your PyInstaller installation. Run this command in your terminal:

pip show pyinstaller

Look for the Location line in the output. It’ll look something like this:

Location: /home/your-username/.local/lib/python3.6/site-packages

The actual pyinstaller executable lives in the bin folder of that parent directory. So in this example, the full path to the command is /home/your-username/.local/bin/pyinstaller.

Step 2: Check if this path is in your system PATH

Next, let’s see if that bin directory is already in your system’s PATH (the list of places your terminal looks for commands). Run:

echo $PATH

Look for the path we found in Step 1 (like /home/your-username/.local/bin). If you don’t see it, that’s exactly why the terminal can’t find pyinstaller.

Step 3: Fix the PATH temporarily (for the current terminal session)

If you just need to use PyInstaller right now, run this command to add the path to your current session’s PATH:

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

Now try running pyinstaller myscript.py again—it should work!

Step 4: Fix the PATH permanently (for all future sessions)

To make this fix stick every time you open a terminal, we’ll add the path to your shell configuration file:

  1. Open your .bashrc file with a text editor (we’ll use nano here, it’s simple):
    nano ~/.bashrc
    
  2. Scroll to the very bottom of the file and add this line:
    export PATH="$HOME/.local/bin:$PATH"
    
  3. Save the file by pressing Ctrl+O, hit Enter, then exit nano with Ctrl+X.
  4. Make the changes take effect immediately by running:
    source ~/.bashrc
    

Bonus: Double-check your pip/Python version match

Ubuntu 18.04 comes with both Python 2 and Python 3 pre-installed. If you used pip (which defaults to Python 2) but your script uses Python 3, you might have installed PyInstaller for the wrong version. Fix this by installing it with pip3 instead:

pip3 install pyinstaller

Then repeat the steps above if needed (though pip3 will still install to ~/.local/bin in most cases).

内容的提问来源于stack exchange,提问作者afsara_ben

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.09 13:32:41