Windows 安装 oslo.messaging 依赖问题

发布时间: 更新时间: 总字数:402 阅读时间:1m 作者: IP上海 分享 网址

解决 windows 使用 pip 安装 oslo.messaging 时依赖 Microsoft C++ Build Tools 问题

错误日志

$ pip install oslo.messaging
Collecting oslo.messaging
  Downloading oslo.messaging-12.9.1-py3-none-any.whl (250 kB)
...
Collecting extras>=1.0.0
  Downloading extras-1.0.0-py2.py3-none-any.whl (7.3 kB)
Using legacy 'setup.py install' for netifaces, since package 'wheel' is not installed.
Using legacy 'setup.py install' for wrapt, since package 'wheel' is not installed.
Using legacy 'setup.py install' for Yappi, since package 'wheel' is not installed.
Installing collected packages: wrapt, six, pyparsing, pbr, urllib3, pytz, packaging, oslo.i18n, netifaces, netaddr, iso8601, idna, debtcollector, charset-normalizer, certifi, stevedore, rfc3986, requests, PyYAML, pycparser, oslo.utils, msgpack, extras, vine, testtools, repoze.lru, python-dateutil, oslo.serialization, oslo.context, oslo.config, MarkupSafe, greenlet, fasteners, dnspython, cffi, Yappi, WebOb, statsd, Routes, prometheus-client, PasteDeploy, Paste, oslo.log, oslo.concurrency, Jinja2, fixtures, eventlet, bcrypt, amqp, oslo.service, oslo.middleware, oslo.metrics, kombu, futurist, cachetools, oslo.messaging
    Running setup.py install for wrapt: started
    Running setup.py install for wrapt: finished with status 'done'
    Running setup.py install for netifaces: started
    Running setup.py install for netifaces: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\xiexianbin\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xiexianbin\\AppData\\Local\\Temp\\pip-install-7cd29ci2\\netifaces_581105673b9d48e283e8a11494a52076\\setup.py'"'"'; __file__='"'"'C:\\Users\\xiexianbin\\AppData\\Local\\Temp\\pip-install-7cd29ci2\\netifaces_581105673b9d48e283e8a11494a52076\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\xiexianbin\AppData\Local\Temp\pip-record-8ya9ipn0\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xiexianbin\AppData\Local\Programs\Python\Python39\Include\netifaces'
         cwd: C:\Users\xiexianbin\AppData\Local\Temp\pip-install-7cd29ci2\netifaces_581105673b9d48e283e8a11494a52076\
    Complete output (5 lines):
    running install
    running build
    running build_ext
    building 'netifaces' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\xiexianbin\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xiexianbin\\AppData\\Local\\Temp\\pip-install-7cd29ci2\\netifaces_581105673b9d48e283e8a11494a52076\\setup.py'"'"'; __file__='"'"'C:\\Users\\xiexianbin\\AppData\\Local\\Temp\\pip-install-7cd29ci2\\netifaces_581105673b9d48e283e8a11494a52076\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\xiexianbin\AppData\Local\Temp\pip-record-8ya9ipn0\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xiexianbin\AppData\Local\Programs\Python\Python39\Include\netifaces' Check the logs for full command output.
WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.
You should consider upgrading via the 'C:\Users\xiexianbin\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command.

解决方式

从日志看,是由于安装 Yappi 没有找到对应的 whl,导致从源码安装,并依赖 Microsoft C++ Build Tools 引起。因此,我们可以找到 Yappiwhl 安装包,手动安装。

该包可以在 https://www.lfd.uci.edu/~gohlke/pythonlibs/#yappi 根据匹配的 Python 版本下载。

Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数