【问题标题】:Command "python3 -m pip install [...]" failed with error code 1 in None命令“python3 -m pip install [...]”失败,错误代码 1 为无
【发布时间】:2019-08-28 13:39:13
【问题描述】:

我正在尝试通过我的 Mac 上的终端安装 Python 的 PyInstaller 模块,但它不工作。

我正在尝试安装此模块,以便打包程序。我尝试通过不同的命令(例如“pip install pyinstaller”)通过终端安装,但它不起作用,即使我知道我已经正确安装了 PIP。

尝试安装时,我输入python3 -m pip install pyinstaller。

结果是Command "/usr/local/bin/python3 -m pip install --ignore-installed --no-user --prefix /private/var/folders/w5/rlzrygt57j3c3nl4p29d2djc0000gw/T/pip-build-env-mjrd7sir https://files.pythonhosted.org/packages/b2/86/095d2f7829badc207c893dd4ac767e871f6cd547145df797ea26baea4e2e/setuptools-41.2.0-py2.py3-none-any.whl#sha256=4380abcf2a4ffd1a5ba22d687c6d690dce83b2b51c70e9c6d09f7e8c7e8040dc https://files.pythonhosted.org/packages/00/83/b4a77d044e78ad1a45610eb88f745be2fd2c6d658f9798a15e384b7d57c9/wheel-0.33.6-py2.py3-none-any.whl#sha256=f4da1763d3becf2e2cd92a14a7c920f0f00eca30fdde9ea992c836685b9faf28" failed with error code 1 in None

我已升级 PIP,并尝试使用 sudo python3 -m pip install pyinstaller,但我不在 sudoers 文件中。

请帮忙

【问题讨论】:

  • 试试--user 标志,可能行不通,但至少尝试一下也无妨。

标签: python macos terminal pip pyinstaller


【解决方案1】:

在您的项目目录中为您的项目创建一个虚拟环境。

python3 -m venv env
source env/bin/activate

测试哪个python被激活

which python

这将表明你刚刚创建的virtualenv中的本地python现在是当前的python

现在尝试安装

pip install pyinstaller

这应该对你有用。除非您确实需要为系统进行设置,否则请始终为您的项目使用虚拟环境,而不是安装系统范围的库。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-04
    • 2020-05-19
    • 1970-01-01
    • 2015-10-09
    • 2018-12-03
    • 1970-01-01
    相关资源
    最近更新 更多