首页 > 解决方案 > 无法使用 pip 安装新的 tflite-support

问题描述

按照这个链接,我一直在尝试tflite-support使用 pip 安装模块。我收到以下错误:

ERROR: Command errored out with exit status 1:
 command: /usr/local/opt/python/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gg/1zr67t6d11lczcdmc7tc3y000000gn/T/pip-install-tfso4suc/tflite-support/setup.py'"'"'; __file__='"'"'/private/var/folders/gg/1zr67t6d11lczcdmc7tc3y000000gn/T/pip-install-tfso4suc/tflite-support/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/gg/1zr67t6d11lczcdmc7tc3y000000gn/T/pip-install-tfso4suc/tflite-support/pip-egg-info
     cwd: /private/var/folders/gg/1zr67t6d11lczcdmc7tc3y000000gn/T/pip-install-tfso4suc/tflite-support/
Complete output (27 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/gg/1zr67t6d11lczcdmc7tc3y000000gn/T/pip-install-tfso4suc/tflite-support/setup.py", line 178, in <module>
    zip_safe=False,
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/setuptools/__init__.py", line 143, in setup
    _install_setup_requires(attrs)
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/setuptools/dist.py", line 698, in fetch_build_eggs
    replace_conflicting=True,
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/pkg_resources/__init__.py", line 783, in resolve
    replace_conflicting=replace_conflicting
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/pkg_resources/__init__.py", line 1066, in best_match
    return self.obtain(req, installer)
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/pkg_resources/__init__.py", line 1078, in obtain
    return installer(requirement)
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/setuptools/dist.py", line 754, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/setuptools/installer.py", line 133, in fetch_build_egg
    wheel.install_as_egg(dist_location)
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/setuptools/wheel.py", line 103, in install_as_egg
    self._install_as_egg(destination_eggdir, zf)
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/setuptools/wheel.py", line 111, in _install_as_egg
    self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
  File "/Users/anupamchugh/Library/Python/3.7/lib/python/site-packages/setuptools/wheel.py", line 132, in _convert_metadata
    os.mkdir(destination_eggdir)
FileExistsError: [Errno 17] File exists: '/private/var/folders/gg/1zr67t6d11lczcdmc7tc3y000000gn/T/pip-install-tfso4suc/tflite-support/.eggs/pybind11-2.4.3-py3.7.egg'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

有什么线索吗?我知道以前有人问类似的问题,但这些答案没有运气

标签: pythontensorflowpippackagetensorflow2.0

解决方案


将评论变成答案:

这看起来像是setuptools. 降级到41:

$ pip install --upgrade 'setuptools<42'

现在(理想情况下)预安装pybind11以避免在构建tflite-support轮子时丢失标题:

$ pip install 'pybind11>=2.4'

现在安装tflite-support应该成功,没有任何中间错误:

$ pip install tflite-support

推荐阅读