python3 pip安装模块过程中提示error: invalid command 'bdist_wheel'错误的解决办法

有时候使用系统自带(比如ubuntu apt-get安装的python3-pip)的pip来安装第三方模块时,会提示类似这样的错误:

$ pip3 install TA-Lib
Collecting TA-Lib
  Using cached https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz
Collecting numpy (from TA-Lib)
  Using cached https://files.pythonhosted.org/packages/ad/15/690c13ae714e156491392cdbdbf41b485d23c285aa698239a67f7cfc9e0a/numpy-1.16.1-cp35-cp35m-manylinux1_x86_64.whl
Building wheels for collected packages: TA-Lib
  Running setup.py bdist_wheel for TA-Lib ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-fzbm7o45/TA-Lib/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/tmpt6ig4mhepip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
 
  error: invalid command 'bdist_wheel'
 
  ----------------------------------------
  Failed building wheel for TA-Lib
  Running setup.py clean for TA-Lib
Failed to build TA-Lib
Installing collected packages: numpy, TA-Lib
  Running setup.py install for TA-Lib ... done
Successfully installed TA-Lib-0.4.17 numpy-1.16.1

这是由于系统少了wheel包导致的。安装相应的包就可解决。

$ sudo apt-get install python3-pip python3-setuptools python3-dev python3-wheel
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
python3-pip 已经是最新版 (9.0.1-2)。
python3-setuptools 已经是最新版 (33.1.1-1)。
python3-dev 已经是最新版 (3.5.3-1)。
推荐安装:
  python3-keyring python3-keyrings.alt
下列【新】软件包将被安装:
  python3-wheel
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 51.8 kB 的归档。
解压缩后会消耗 216 kB 的额外空间。
您希望继续执行吗? [Y/n]
获取:1 https://cdn-aws.deb.debian.org/debian stretch/main amd64 python3-wheel all 0.29.0-2 [51.8 kB]
已下载 51.8 kB,耗时 12秒 (4,196 B/s)                                                                                                                                   
正在选中未选择的软件包 python3-wheel。
(正在读取数据库 ... 系统当前共安装有 236821 个文件和目录。)
正准备解包 .../python3-wheel_0.29.0-2_all.deb  ...
正在解包 python3-wheel (0.29.0-2) ...
正在设置 python3-wheel (0.29.0-2) ...

再安装没有error了

$ pip3 install TA-Lib
Collecting TA-Lib
  Using cached https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz
Collecting numpy (from TA-Lib)
  Using cached https://files.pythonhosted.org/packages/ad/15/690c13ae714e156491392cdbdbf41b485d23c285aa698239a67f7cfc9e0a/numpy-1.16.1-cp35-cp35m-manylinux1_x86_64.whl
Building wheels for collected packages: TA-Lib
  Running setup.py bdist_wheel for TA-Lib ... done
  Stored in directory: /home/zhangshoug/.cache/pip/wheels/2a/2e/ec/71c565b2e0091e03a2b56abfbfd062f14a01a8d7b20ffe8bd5
Successfully built TA-Lib
Installing collected packages: numpy, TA-Lib
Successfully installed TA-Lib-0.4.17 numpy-1.16.1

 

 

你可能感兴趣的:(python3 pip安装模块过程中提示error: invalid command 'bdist_wheel'错误的解决办法)