我的tox.ini文件在
Windows上看起来像这样
[tox]
envlist = cpy27,dpy27
skip_missing_interpreters = True
[testenv]
basepython =
cpy27: C:\Python27\python.exe
dpy27: D:\Python27\python.exe
deps =
pytest
commands = py.test tests
但是当我从命令提示符执行“tox”时,我看到了这个错误.为什么是这样?如果我在命令行上运行python setup.py install,我没有看到任何错误
Installing collected packages: coverage, pytest-cov, requests, psutil, pytz, enum, argh, pathtools, PyYAML, watchdog, monit
Running setup.py install for PyYAML: started
Running setup.py install for PyYAML: finished with status 'error'
Complete output from command d:\repos\foo\.tox\dpy27\scripts\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\foo\\appdata\\local\\temp\\pip-build-bbx8kz\\PyYAML\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\vikone\appdata\local\temp\pip-zyvbbh-record\install-record.txt --single-version-externally-managed --compile --install-headers d:\repos\foo\.tox\dpy27\include\site\python2.7\PyYAML:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\yaml
copying lib\yaml\composer.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\constructor.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\cyaml.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\dumper.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\emitter.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\error.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\events.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\loader.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\nodes.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\parser.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\reader.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\representer.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\resolver.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\scanner.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\serializer.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\tokens.py -> build\lib.win-amd64-2.7\yaml
copying lib\yaml\__init__.py -> build\lib.win-amd64-2.7\yaml
running build_ext
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
checking if libyaml is compilable
error: [Error 2] The system cannot find the file specified
UPDATE
我注意到,当我手动激活virtualenv并执行“pip install pyyaml”时,它失败并出现相同的错误.但是当我在常规命令提示符中,而不是virtualenv,并执行相同的命令时,它安装得很好.
所以这似乎是pyyaml和virtualenv的一个问题,但不是tox本身.
此外,如果我在tox.ini中尝试使用easy_install命令,它可以解决任何问题.
[testenv]
install_command = easy_install {opts} {packages}
最佳答案 看起来二进制文件没有轮子,当PIP下载PyYAML时,它试图构建它而不能.
我通过下载源代码,构建一个轮子然后将其上传到我的本地devpi服务器来为我的计算机修复此问题.然后我可以在virtualenv中使用pip安装它.
我正在使用Windows 10,如果这很重要的话.