如何正确安装pyinstaller

如何正确安装pyinstaller

本文介绍了如何正确安装pyinstaller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have attempted to install pyinstaller (on Ubuntu 16.0.4) using pip:

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

However, if I then try to call pyinstaller I get the error pyinstaller: command not found

当pip安装似乎成功时,为什么不能运行pyinstaller.

Why am I unable to run pyinstaller when the pip install appears to have been successful.

推荐答案

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

pyinstaller appears to have installed correctly, but the command is not available on PATH. You need to locate where the executable was placed. This will depend on your system configuration, if you're using virtualenv, and other system and usage dependent factors.

您可以尝试使用find查找可执行文件:

One thing you could try is using find to locate the executable:

sudo find / -name pyinstaller

这将从文件系统的根目录开始递归查找名为pyinstaller的文件.如果您知道可执行文件的放置位置,则可以将搜索范围缩小到该目录.

This recursively looks for a file named pyinstaller, starting at the root of the file system. If you have some idea where the executable may have been placed, you can narrow the search to that directory.

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

Once you have the absolute path of the executable, you can either call it directly:

/my/path/to/pyinstaller

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

Or if you're not using virtualenv or anything, you could modify PATH to include the executable's parent directory:

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

如果要永久保留该更改,则需要在某处修改脚本.

If you want to make that change permanent, you need to modify a script somewhere.

这篇关于如何正确安装pyinstaller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 05:28