如何修复“error: invalid command 'bdist_wheel'”错误?

45

我尝试在Ubuntu 20.04.01上安装Watchman:

guettli@yoga15:~/tmp$ python3 -m venv pywatchman-test
guettli@yoga15:~/tmp$ cd pywatchman-test
guettli@yoga15:~/tmp/pywatchman-test$ . bin/activate

(pywatchman-test) guettli@yoga15:~/tmp/pywatchman-test$ pip install pywatchman

失败:

Collecting pywatchman
  Using cached pywatchman-1.4.1.tar.gz (29 kB)
Building wheels for collected packages: pywatchman
  Building wheel for pywatchman (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/guettli/tmp/pywatchman-test/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-on_zbadt/pywatchman/setup.py'"'"'; __file__='"'"'/tmp/pip-install-on_zbadt/pywatchman/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-9np2rv_b
       cwd: /tmp/pip-install-on_zbadt/pywatchman/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for pywatchman
  Running setup.py clean for pywatchman
Failed to build pywatchman
Installing collected packages: pywatchman
    Running setup.py install for pywatchman ... done
Successfully installed pywatchman-1.4.1

我找到了一个解决方法:如果我卸载 pywatchman 并安装 wheel,那么它就可以正常工作。

我想为 watchman 创建一个补丁(patch),以便它可以直接使用。

如何解决这个问题,以便将来不会再发生这种情况?

相关内容: https://github.com/facebook/watchman/issues/876


4
这个回答解决了你的问题吗?为什么Travis CI上Python的setup.py会显示"invalid command 'bdist_wheel'"? - Abhigyan Jaiswal
2
@AbhigyanJaiswal的评论应该被发布并接受为解决问题的答案。 - Kernel
1个回答

76

跑步

pip install wheel

或者

pip3 install wheel
或者
python3 -m pip install wheel

问题已被解决。


它对我有效。 - 71GA
1
正确答案!!! - activedecay
2
特别是在虚拟环境中运行时,首先安装wheel可以使其正常工作。全局Python范围内安装的wheel不会被使用,因此必须首先执行此操作。 - vpathak
轮子是什么,为什么我必须安装一个<1.0的包才能让其他包正常工作? - Post Self
1
我谦虚地建议使用 python -m pip install wheel 以保持清醒。 - JimmyJames

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接