在 windows 中安装 pygit2 时如何让 pip 看到 libgit2 二进制文件?
How I make pip see libgit2 binary while installing pygit2 in windows?
我正在尝试使用 pip
python 脚本安装 pygit2
,但它总是失败并显示此消息
error: Unable to find vcvarsall.bat
我没有安装 Visual Studio,所以我尝试使用 MinGW
编译 libgit2
并且成功了。但是 pip
仍然无法确定 libgit2
已安装。
我该怎么办?
编辑
我安装了 Visual Studio express 2010 和 运行 命令,这次错误不同:
Downloading/unpacking pygit2
Running setup.py (path:C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py) egg_info for
building 'pygit2_cffi_7cfafa3dx5470904' extension
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py", line 197, in <module>
cmdclass=cmdclass)
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "<string>", line 15, in replacement_run
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 186, in find_sources
mm.run()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 246, in run
self.add_defaults()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 282, in add_defaults
sdist.add_defaults(self)
File "C:\Python34\lib\site-packages\setuptools\command\sdist.py", line 161, in add_defaults
build_py = self.get_finalized_command('build_py')
File "C:\Python34\lib\distutils\cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Python34\lib\site-packages\setuptools\command\build_py.py", line 26, in finalize_opti
_build_py.finalize_options(self)
File "C:\Python34\lib\distutils\command\build_py.py", line 45, in finalize_options
('force', 'force'))
File "C:\Python34\lib\distutils\cmd.py", line 287, in set_undefined_options
src_cmd_obj.ensure_finalized()
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py", line 103, in finalize_op
ffi, C = get_ffi()
File "pygit2\_utils.py", line 101, in get_ffi
include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
File "C:\Python34\lib\site-packages\cffi\api.py", line 373, in verify
lib = self.verifier.load_library()
File "C:\Python34\lib\site-packages\cffi\verifier.py", line 96, in load_library
self._compile_module()
File "C:\Python34\lib\site-packages\cffi\verifier.py", line 192, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 38, in compile
outputfilename = _build(tmpdir, ext)
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 62, in _build
dist.run_command('build_ext')
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 52, in run
_build_ext.run(self)
File "C:\Python34\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Python34\lib\distutils\command\build_ext.py", line 448, in build_extensions
self.build_extension(ext)
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 186, in build_exten
_build_ext.build_extension(self,ext)
File "C:\Python34\lib\distutils\command\build_ext.py", line 503, in build_extension
depends=ext.depends)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 460, in compile
self.initialize()
File "C:\Python34\lib\distutils\msvc9compiler.py", line 371, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: ['path']
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info\pygit2.egg-info
writing top-level names to pip-egg-info\pygit2.egg-info\top_level.txt
writing pip-egg-info\pygit2.egg-info\PKG-INFO
writing requirements to pip-egg-info\pygit2.egg-info\requires.txt
writing dependency_links to pip-egg-info\pygit2.egg-info\dependency_links.txt
writing manifest file 'pip-egg-info\pygit2.egg-info\SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
running build_ext
building 'pygit2_cffi_7cfafa3dx5470904' extension
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py", line 197, in <module>
cmdclass=cmdclass)
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "<string>", line 15, in replacement_run
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 186, in find_sources
mm.run()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 246, in run
self.add_defaults()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 282, in add_defaults
sdist.add_defaults(self)
File "C:\Python34\lib\site-packages\setuptools\command\sdist.py", line 161, in add_defaults
build_py = self.get_finalized_command('build_py')
File "C:\Python34\lib\distutils\cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Python34\lib\site-packages\setuptools\command\build_py.py", line 26, in finalize_options
_build_py.finalize_options(self)
File "C:\Python34\lib\distutils\command\build_py.py", line 45, in finalize_options
('force', 'force'))
File "C:\Python34\lib\distutils\cmd.py", line 287, in set_undefined_options
src_cmd_obj.ensure_finalized()
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py", line 103, in finalize_option
ffi, C = get_ffi()
File "pygit2\_utils.py", line 101, in get_ffi
include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
File "C:\Python34\lib\site-packages\cffi\api.py", line 373, in verify
lib = self.verifier.load_library()
File "C:\Python34\lib\site-packages\cffi\verifier.py", line 96, in load_library
self._compile_module()
File "C:\Python34\lib\site-packages\cffi\verifier.py", line 192, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 38, in compile
outputfilename = _build(tmpdir, ext)
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 62, in _build
dist.run_command('build_ext')
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 52, in run
_build_ext.run(self)
File "C:\Python34\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Python34\lib\distutils\command\build_ext.py", line 448, in build_extensions
self.build_extension(ext)
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 186, in build_extension
_build_ext.build_extension(self,ext)
File "C:\Python34\lib\distutils\command\build_ext.py", line 503, in build_extension
depends=ext.depends)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 460, in compile
self.initialize()
File "C:\Python34\lib\distutils\msvc9compiler.py", line 371, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: ['path']
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in C:\Users\One\AppData\Local\Temp\pip_bui
Storing debug log for failure in C:\Users\One\pip\pip.log
这是适合您的解决方案。
您可能试图修复错误的东西。
vcvarsall.bat 是这里的主要问题
error: Unable to find vcvarsall.bat
我正在尝试使用 pip
python 脚本安装 pygit2
,但它总是失败并显示此消息
error: Unable to find vcvarsall.bat
我没有安装 Visual Studio,所以我尝试使用 MinGW
编译 libgit2
并且成功了。但是 pip
仍然无法确定 libgit2
已安装。
我该怎么办?
编辑
我安装了 Visual Studio express 2010 和 运行 命令,这次错误不同:
Downloading/unpacking pygit2
Running setup.py (path:C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py) egg_info for
building 'pygit2_cffi_7cfafa3dx5470904' extension
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py", line 197, in <module>
cmdclass=cmdclass)
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "<string>", line 15, in replacement_run
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 186, in find_sources
mm.run()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 246, in run
self.add_defaults()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 282, in add_defaults
sdist.add_defaults(self)
File "C:\Python34\lib\site-packages\setuptools\command\sdist.py", line 161, in add_defaults
build_py = self.get_finalized_command('build_py')
File "C:\Python34\lib\distutils\cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Python34\lib\site-packages\setuptools\command\build_py.py", line 26, in finalize_opti
_build_py.finalize_options(self)
File "C:\Python34\lib\distutils\command\build_py.py", line 45, in finalize_options
('force', 'force'))
File "C:\Python34\lib\distutils\cmd.py", line 287, in set_undefined_options
src_cmd_obj.ensure_finalized()
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py", line 103, in finalize_op
ffi, C = get_ffi()
File "pygit2\_utils.py", line 101, in get_ffi
include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
File "C:\Python34\lib\site-packages\cffi\api.py", line 373, in verify
lib = self.verifier.load_library()
File "C:\Python34\lib\site-packages\cffi\verifier.py", line 96, in load_library
self._compile_module()
File "C:\Python34\lib\site-packages\cffi\verifier.py", line 192, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 38, in compile
outputfilename = _build(tmpdir, ext)
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 62, in _build
dist.run_command('build_ext')
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 52, in run
_build_ext.run(self)
File "C:\Python34\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Python34\lib\distutils\command\build_ext.py", line 448, in build_extensions
self.build_extension(ext)
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 186, in build_exten
_build_ext.build_extension(self,ext)
File "C:\Python34\lib\distutils\command\build_ext.py", line 503, in build_extension
depends=ext.depends)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 460, in compile
self.initialize()
File "C:\Python34\lib\distutils\msvc9compiler.py", line 371, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: ['path']
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info\pygit2.egg-info
writing top-level names to pip-egg-info\pygit2.egg-info\top_level.txt
writing pip-egg-info\pygit2.egg-info\PKG-INFO
writing requirements to pip-egg-info\pygit2.egg-info\requires.txt
writing dependency_links to pip-egg-info\pygit2.egg-info\dependency_links.txt
writing manifest file 'pip-egg-info\pygit2.egg-info\SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
running build_ext
building 'pygit2_cffi_7cfafa3dx5470904' extension
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py", line 197, in <module>
cmdclass=cmdclass)
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "<string>", line 15, in replacement_run
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 186, in find_sources
mm.run()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 246, in run
self.add_defaults()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 282, in add_defaults
sdist.add_defaults(self)
File "C:\Python34\lib\site-packages\setuptools\command\sdist.py", line 161, in add_defaults
build_py = self.get_finalized_command('build_py')
File "C:\Python34\lib\distutils\cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Python34\lib\site-packages\setuptools\command\build_py.py", line 26, in finalize_options
_build_py.finalize_options(self)
File "C:\Python34\lib\distutils\command\build_py.py", line 45, in finalize_options
('force', 'force'))
File "C:\Python34\lib\distutils\cmd.py", line 287, in set_undefined_options
src_cmd_obj.ensure_finalized()
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Users\One\AppData\Local\Temp\pip_build_One\pygit2\setup.py", line 103, in finalize_option
ffi, C = get_ffi()
File "pygit2\_utils.py", line 101, in get_ffi
include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
File "C:\Python34\lib\site-packages\cffi\api.py", line 373, in verify
lib = self.verifier.load_library()
File "C:\Python34\lib\site-packages\cffi\verifier.py", line 96, in load_library
self._compile_module()
File "C:\Python34\lib\site-packages\cffi\verifier.py", line 192, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 38, in compile
outputfilename = _build(tmpdir, ext)
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 62, in _build
dist.run_command('build_ext')
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 52, in run
_build_ext.run(self)
File "C:\Python34\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Python34\lib\distutils\command\build_ext.py", line 448, in build_extensions
self.build_extension(ext)
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 186, in build_extension
_build_ext.build_extension(self,ext)
File "C:\Python34\lib\distutils\command\build_ext.py", line 503, in build_extension
depends=ext.depends)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 460, in compile
self.initialize()
File "C:\Python34\lib\distutils\msvc9compiler.py", line 371, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: ['path']
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in C:\Users\One\AppData\Local\Temp\pip_bui
Storing debug log for failure in C:\Users\One\pip\pip.log
这是适合您的解决方案。 您可能试图修复错误的东西。
vcvarsall.bat 是这里的主要问题
error: Unable to find vcvarsall.bat