python - 如何正确安装pyinstaller

标签 python pip pyinstaller

我尝试使用 pip 安装 pyinstaller(在 Ubuntu 16.0.4 上):

pip3 install pyinstaller

Collecting pyinstaller
  Using cached PyInstaller-3.2.tar.gz
Collecting setuptools (from pyinstaller)
  Using cached setuptools-25.1.3-py2.py3-none-any.whl
Building wheels for collected packages: pyinstaller
  Running setup.py bdist_wheel for pyinstaller ... done
  Stored in directory: /home/.../.cache/pip/wheels/fc/b3/10/006225b1c1baa34750a7b587d3598d47d18114c06b696a8e0e
Successfully built pyinstaller
Installing collected packages: setuptools, pyinstaller
Successfully installed pyinstaller setuptools-20.7.0
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

但是,如果我随后尝试调用 pyinstaller,我会收到错误消息 pyinstaller: command not found

当 pip 安装似乎已成功时,为什么我无法运行 pyinstaller。

最佳答案

pyinstaller 似乎已正确安装,但该命令在 PATH 上不可用。您需要找到可执行文件的放置位置。这将取决于您的系统配置,如果您使用的是 virtualenv,以及其他系统和使用相关因素。

您可以尝试使用 find 来定位可执行文件:

sudo find / -name pyinstaller

这会递归地查找名为 pyinstaller 的文件,从文件系统的根目录开始。如果您知道可执行文件可能放在哪里,您可以将搜索范围缩小到该目录。

一旦你有了可执行文件的绝对路径,你就可以直接调用它:

/my/path/to/pyinstaller

或者,如果您不使用 virtualenv 或其他任何东西,您可以修改 PATH 以包含可执行文件的父目录:

$PATH = $PATH:/my/path/to

如果你想让这个改变永久化,你需要modify a script somewhere .

关于python - 如何正确安装pyinstaller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38746462/

相关文章:

python - 如何软删除与 Django 的多对多关系

python 和 ehem 安装

python - pyinstaller 不导入子模块

python - 使用 Pandas query() 过滤时间戳列上的数据帧

python - numpy arange函数构建数组大小错误

python - 如何训练 tensorflow 模型准确区分睁眼和闭眼?

python - 如何将 virtualenv 添加到路径

python - pip uninstall 工作但给出错误

scipy - 导入 scipy 或 scipy.signal 时 Pyinstaller --onefile 警告 pyconfig.h

python - 我如何通过我的规范文件说服 PyInstaller 在它生成的 EXE 中包含 libvlc.dll?