问题
I've tried everything in this very related question: Why can I not create a wheel in python?
But I still get:
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'
Context:
$ pip --version
pip 8.1.1 from /home/bdillman/proj/fashion/lib/python3.5/site-packages (python 3.5)
$ python -c "import setuptools; print(setuptools.__version__)"
18.2
$ python --version
Python 3.5.1
$ which python
/home/bdillman/workspace/fashion/bin/python
$ pip list
Mako (1.0.4)
MarkupSafe (0.23)
peewee (2.8.0)
pip (8.1.1)
PyYAML (3.11)
setuptools (21.0.0)
wheel (0.29.0)
So it looks like everything is installed and the versions look good (I think). Anyone have ideas of things to check to further the diagnosis here?
The exact command is:
$ python setup.py bdist_wheel
I've also tried
$ sudo python setup.py bdist_wheel
I've also done pip install --upgrade setuptools
and pip install --upgrade wheel
, and they're up-to-date.
回答1:
I had this happen to me on a recent Ubuntu using python3 -m venv
(for which you must install python3-venv), where no matter how many times I cleared the environment and retried, I was getting bdist_wheel
errors installing the dependencies for Flask.
In addition to not having venv
by default as normal for a Python 3 install, for some reason on Ubuntu I also seem to have to explicitly install wheel
.
For clarity, the following did not work:
python3 -m venv .
. bin/activate
pip install Flask
However, the following does work:
python3 -m venv .
. bin/activate
pip install wheel
(never had to do this on, say, Arch Linux)pip install Flask
回答2:
Solved it. I'm not sure how, but my python virtual environment was messed up, with pip using a different virtual environment. I fixed my virtual environment and now everything seems to work fine.
I'm new to python and virtual environments, and I think I might've copied a whole project containing a virtual environment, then edited it (and missed some references, say at the top of the pip script).
回答3:
One thing to note is that make sure you are using setuptools
, not distutils
.
来源:https://stackoverflow.com/questions/37029385/cant-build-wheel-error-invalid-command-bdist-wheel