Python/Caffe2: ImportError: No module named tools.setup_helpers.env

Python/Caffe2: ImportError: No module named tools.setup_helpers.env

我无法从 PyPi 存储库安装 Python caffe2 模块。发出 sudo pip install caffe2 时出现以下错误:

$ sudo pip install caffe2
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting caffe2
  Downloading https://files.pythonhosted.org/packages/0f/b5/b4824aeeef2fc0a54e6f9f090545a486c2e5db0e18faae011c16465ee917/caffe2-0.5.0a0.dev100.tar.gz (10.7MB)
    100% |████████████████████████████████| 10.7MB 3.3MB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "", line 1, in 
      File "/tmp/pip-install-C5vRaw/caffe2/setup.py", line 108, in 
        from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
    ImportError: No module named tools.setup_helpers.env

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-C5vRaw/caffe2/

我已阅读 GitHub 上的 installation documentation and have all the dependencies installed, but this error persists. There is a similar issue,但答案不明确,无法解决我的问题。有谁知道如何解决这个问题或安装模块的解决方法?

使用 pip3 而不是 pip(2) 时会出现同样的问题。

感谢您的帮助。

这个包需要 PyTorch。 tools.setup_helpers 是 PyTorch 中的一个包。

https://caffe2.ai/docs/getting-started.html

查看其他安装 Caffe2 的方法