我正在尝试安装pact-python ......就是这样。
我试过virtualenv而没有,仍然得到同样的错误。
我正在跑步:pip install pact-python
。
我还尝试添加标记,以便不使用缓存进行安装--no-cache-dir
。
我在Windows 10上使用python 2.7.14。
输出:
pip install pact-python --no-cache-dir Collecting pact-python Downloading pact-python-0.10.0.tar.gz Requirement already satisfied: click>=2.0.0 in c:\rep\test_project\env\lib\site-packages (from pact-python) Requirement already satisfied: psutil>=2.0.0 in c:\rep\test_project\env\lib\site-packages (from pact-python) Requirement already satisfied: requests>=2.5.0 in c:\rep\test_project\env\lib\site-packages (from pact-python) Requirement already satisfied: six>=1.9.0 in c:\rep\test_project\env\lib\site-packages (from pact-python) Requirement already satisfied: subprocess32 in c:\rep\test_project\env\lib\site-packages (from pact-python) Requirement already satisfied: chardet=3.0.2 in c:\rep\test_project\env\lib\site-packages (from requests>=2.5.0->pact-python) Requirement already satisfied: certifi>=2017.4.17 in c:\rep\test_project\env\lib\site-packages (from requests>=2.5.0->pact-python) Requirement already satisfied: urllib3=1.21.1 in c:\rep\test_project\env\lib\site-packages (from requests>=2.5.0->pact-python) Requirement already satisfied: idna=2.5 in c:\rep\test_project\env\lib\site-packages (from requests>=2.5.0->pact-python) Installing collected packages: pact-python Running setup.py install for pact-python ... error Complete output from command c:\rep\test_project\env\scripts\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\212683~1\\appdata\\local\\temp\\pip-build-b0yskn\\pact-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\212683~1\appdata\local\temp\pip-tbudil-record\install-record.txt --single-version-externally-managed --compile --install-headers c:\rep\test_project\env\include\site\python2.7\pact-python: running install running build running build_py creating build creating build\lib creating build\lib\pact copying pact\constants.py -> build\lib\pact copying pact\consumer.py -> build\lib\pact copying pact\matchers.py -> build\lib\pact copying pact\pact.py -> build\lib\pact copying pact\provider.py -> build\lib\pact copying pact\verify.py -> build\lib\pact copying pact\__init__.py -> build\lib\pact copying pact\__version__.py -> build\lib\pact running install_lib creating c:\rep\test_project\env\Lib\site-packages\pact copying build\lib\pact\constants.py -> c:\rep\test_project\env\Lib\site-packages\pact copying build\lib\pact\consumer.py -> c:\rep\test_project\env\Lib\site-packages\pact copying build\lib\pact\matchers.py -> c:\rep\test_project\env\Lib\site-packages\pact copying build\lib\pact\pact.py -> c:\rep\test_project\env\Lib\site-packages\pact copying build\lib\pact\provider.py -> c:\rep\test_project\env\Lib\site-packages\pact copying build\lib\pact\verify.py -> c:\rep\test_project\env\Lib\site-packages\pact copying build\lib\pact\__init__.py -> c:\rep\test_project\env\Lib\site-packages\pact copying build\lib\pact\__version__.py -> c:\rep\test_project\env\Lib\site-packages\pact byte-compiling c:\rep\test_project\env\Lib\site-packages\pact\constants.py to constants.pyc byte-compiling c:\rep\test_project\env\Lib\site-packages\pact\consumer.py to consumer.pyc byte-compiling c:\rep\test_project\env\Lib\site-packages\pact\matchers.py to matchers.pyc byte-compiling c:\rep\test_project\env\Lib\site-packages\pact\pact.py to pact.pyc byte-compiling c:\rep\test_project\env\Lib\site-packages\pact\provider.py to provider.pyc byte-compiling c:\rep\test_project\env\Lib\site-packages\pact\verify.py to verify.pyc byte-compiling c:\rep\test_project\env\Lib\site-packages\pact\__init__.py to __init__.pyc byte-compiling c:\rep\test_project\env\Lib\site-packages\pact\__version__.py to __version__.pyc running install_egg_info running egg_info writing requirements to pact_python.egg-info\requires.txt writing pact_python.egg-info\PKG-INFO writing top-level names to pact_python.egg-info\top_level.txt writing dependency_links to pact_python.egg-info\dependency_links.txt writing entry points to pact_python.egg-info\entry_points.txt reading manifest file 'pact_python.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' no previously-included directories found matching 'pact\test' no previously-included directories found matching 'pact\bin' no previously-included directories found matching 'e2e' writing manifest file 'pact_python.egg-info\SOURCES.txt' Copying pact_python.egg-info to c:\rep\test_project\env\Lib\site-packages\pact_python-0.10.0-py2.7.egg-info running install_scripts Installing pact-verifier-script.py script to c:\rep\test_project\env\Scripts Installing pact-verifier.exe script to c:\rep\test_project\env\Scripts Installing pact-verifier.exe.manifest script to c:\rep\test_project\env\Scripts writing list of installed files to 'c:\users\212683~1\appdata\local\temp\pip-tbudil-record\install-record.txt' Traceback (most recent call last): File "", line 1, in File "c:\users\212683~1\appdata\local\temp\pip-build-b0yskn\pact-python\setup.py", line 139, in setup(**setup_args) File "c:\rep\test_project\env\lib\site-packages\setuptools\__init__.py", line 129, in setup return distutils.core.setup(**attrs) File "c:\python27\Lib\distutils\core.py", line 151, in setup dist.run_commands() File "c:\python27\Lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "c:\python27\Lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "c:\users\212683~1\appdata\local\temp\pip-build-b0yskn\pact-python\setup.py", line 54, in run install_ruby_app(bin_path) File "c:\users\212683~1\appdata\local\temp\pip-build-b0yskn\pact-python\setup.py", line 92, in install_ruby_app with ZipFile(path) as f: File "c:\python27\Lib\zipfile.py", line 770, in __init__ self._RealGetContents() File "c:\python27\Lib\zipfile.py", line 811, in _RealGetContents raise BadZipfile, "File is not a zip file" zipfile.BadZipfile: File is not a zip file ---------------------------------------- Command "c:\rep\test_project\env\scripts\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\212683~1\\appdata\\local\\temp\\pip-build-b0yskn\\pact-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\212683~1\appdata\local\temp\pip-tbudil-record\install-record.txt --single-version-externally-managed --compile --install-headers c:\rep\test_project\env\include\site\python2.7\pact-python" failed with error code 1 in c:\users\212683~1\appdata\local\temp\pip-build-b0yskn\pact-python\
当我尝试查看此文件c:\users\212683~1\appdata\local\temp\pip-build-b0yskn\pact-python\setup.py
以查看正在发生的事情时,它并不存在。我的假设是,这可能只在安装过程中使用。
期望:安装成功。
实际:
File "c:\python27\Lib\zipfile.py", line 811, in _RealGetContents raise BadZipfile, "File is not a zip file" zipfile.BadZipfile: File is not a zip file
修改 我一直在调查,setup.py of pact-python看起来像是安装了一个ruby应用程序。
我确实有C:\rep\test_project\env\Lib\site-packages\pact\bin\win32.zip
,但它似乎是空的。
编辑2: 所以我发现在setup.py中,它正在构建一个uri来从中下载pact-ruby-standalone。构建的uri是https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.1.1/pact-1.1.1-win32.zip。
我的猜测是下载失败,因此文件中没有写入任何内容,所以当代码到达Zipfile(path)
时,win32.zip中没有写入任何内容,然后无法提取任何内容?看着这个。
答案 0 :(得分:0)
我们发现我们的内部代理由于某种原因无法处理下载文件的请求。
我们正在内部开展解决方案,以便更好地管理这样的事情。
答案 1 :(得分:0)
代理祝你好运。如果您对Ruby代码感兴趣,请阅读Pact History(下面的相关引用):https://docs.pact.io/about_pact/history.html
很快很明显,Javascript UI将从使用Pact及其后端API中受益匪浅。在再次使用另一种语言实现Pact的想法之后,我们决定将Ruby实现(包装为独立的可执行文件)包装起来,以避免维护负担和实现不匹配的可能性。这成为用于以下所有Pact实现的模式。每种语言都实现了Pact DSL和模拟服务/验证器客户端,并在后台调用了Ruby模拟服务进程/验证器。
答案 2 :(得分:0)
抱歉,忘记发布决议。事实证明,python-pact设置为下载ruby-pact,正如Beth Skurrie在上面提到的pact实现包含在ruby实现中。
发生的事情是我的代理是在我的会话中设置而不是全局允许pip开始安装pact-python但是当pact-python延伸到ruby实现时,我认为这是一个http下载或其他东西,代理从我的会话中没有被使用,因此.zip是空的。
这导致了最初描述的错误。
希望有一天能帮助某些代理人工作!