首次使用pip,尝试使用the python-docs-samples tutorial library。当我运行" python -m pip install -r requirements.txt"命令,很多脚本被拉入,但后来我得到了一系列"失败的构建轮"错误。其中一个显示在附带的代码块中(请原谅手工输入的自动换行符)。
有什么问题?有人见过这个吗?我没有改变库的任何部分或使用它的代码,我使用的是Python 2.7.12,它应该对PIP有很好的内置支持。
Running setup.py bdist_wheel for PyYAML ... error
Complete output from command C:\users\owner\python-docs-samples\env\Scripts\python.exe
-u -c "import setuptools, tokenize;__file__='c:\\users\\owner\\appdata\\local\\temp\\
pip-build-86ysrg\\PyYAML\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__)
.read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d c:\users\owner\appdata
\local\temp\tmpljy6z0pip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\yaml
copying lib\yaml\composer.py -> build\lib.win32-2.7\yaml
copying lib\yaml\constructor.py -> build\lib.win32-2.7\yaml
copying lib\yaml\cyaml.py -> build\lib.win32-2.7\yaml
copying lib\yaml\dumper.py -> build\lib.win32-2.7\yaml
copying lib\yaml\emitter.py -> build\lib.win32-2.7\yaml
copying lib\yaml\error.py -> build\lib.win32-2.7\yaml
copying lib\yaml\events.py -> build\lib.win32-2.7\yaml
copying lib\yaml\loader.py -> build\lib.win32-2.7\yaml
copying lib\yaml\nodes.py -> build\lib.win32-2.7\yaml
copying lib\yaml\parser.py -> build\lib.win32-2.7\yaml
copying lib\yaml\reader.py -> build\lib.win32-2.7\yaml
copying lib\yaml\representer.py -> build\lib.win32-2.7\yaml
copying lib\yaml\resolver.py -> build\lib.win32-2.7\yaml
copying lib\yaml\scanner.py -> build\lib.win32-2.7\yaml
copying lib\yaml\serializer.py -> build\lib.win32-2.7\yaml
copying lib\yaml\tokens.py -> build\lib.win32-2.7\yaml
copying lib\yaml\__init__.py -> build\lib.win32-2.7\yaml
running build_ext
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
checking if libyaml is compilable
error: [Error 2] The system cannot find the file specified
----------------------------------------
Failed building wheel for PyYAML
Running setup.py clean for PyYAML
答案 0 :(得分:9)
安装常见附属关系
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
答案 1 :(得分:6)
问题是Windows,如果您没有安装编译器工具链,您将遇到依赖性问题并构建C扩展问题。
手动安装某些依赖项的二进制版本(例如PyYAML)是一种解决方案(例如,使用easy_install建议)。要从源代码构建二进制轮,您还可以在此处下载免费的Visual C ++ Compiler for Python 2.7: https://www.microsoft.com/en-ca/download/details.aspx?id=44266
答案 2 :(得分:5)
如上所述,问题是Windows。
您可以从此处下载兼容的python包:
Unofficial Windows Binaries for Python Extension Packages
然后pip安装.whl文件
pip install path_2_file\package.whl
答案 3 :(得分:2)
对我来说,此问题已在Ubuntu 16上通过升级pip得到解决:
pip install --upgrade pip
答案 4 :(得分:2)
在安装pyyaml之前,我通过升级pip,setuptools和wheel摆脱了相同的错误:
footerX
答案 5 :(得分:0)
尝试一下(不确定)
apt-get install -y pyyaml
我收到一个错误消息'subprocess32的构建轮子失败
apt-get install -y python-subprocess32
对我有用!