Windows 7和python与rsync

时间:2011-06-23 14:34:06

标签: python cross-platform rsync

我想使用Python模块进行开发,该模块使用rsync通过SFTP和webdav进行文件传输。 我发现了一个名为pysync的lib(最终还有其他的)。但是我在Windows 7上。我使用的是VisualStudio 2010,但由于“问题”,构建失败了。

所以我想知道是否有人知道有效的librsync或适用于Windows,MacOS和Linux的东西 - 因为我有这个跨平台的要求。

 C:\Python27\Scripts>pip.exe install pysync
    Downloading/unpacking pysync
      Downloading pysync-2.24.tar.bz2
      Running setup.py egg_info for package pysync

        file librsync.py (for module librsync) not found
        warning: no files found matching 'librsync_wrap.*'
        warning: no files found matching 'librsync\COPYING'
        warning: no files found matching 'librsync\*.h'
        warning: no files found matching 'librsync\configure'
        warning: no files found matching 'librsync\Makefile.in'
        warning: no files found matching 'librsync\config.h.in'
        warning: no files found matching 'librsync\config.guess'
        warning: no files found matching 'librsync\config.sub'
        warning: no files found matching 'librsync\install-sh'
        warning: no files found matching 'librsync\popt\Makefile.in'
    Installing collected packages: pysync
      Running setup.py install for pysync
        file librsync.py (for module librsync) not found
        file librsync.py (for module librsync) not found
        building 'md4' extension
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\includ
    e -IC:\Python27\PC /Tcmd4sum/md4module.c /Fobuild\temp.win32-2.7\Release\md4sum/md4module.obj
        md4module.c
        c:\python27\include\pyconfig.h(227) : fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
 [...]

    ----------------------------------------
    Command C:\Python27\python.exe -c "import setuptools;__file__='C:\\Python27\\Scripts\\build\\pysync\\setup.py';exec(compile(op
    en(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record c:\users\w
    ishi\appdata\local\temp\pip-kvzhhk-record\install-record.txt failed with error code 1
    Storing complete log in C:\Users\wishi\AppData\Roaming\pip\pip.log

    C:\Python27\Scripts>

1 个答案:

答案 0 :(得分:1)

你真的与rsync联系在一起吗?您正在使用SFTP传输文件,因此paramiko可能适合您。如果你真的需要一个有效的librsync,你有几个选择。

  1. 搜索预编译版本并安装(希望你的谷歌强大......)
  2. 安装cygwin,下载源代码,运行make install,更改windows build的选项。
  3. 将源代码下载到linux框,并将其设置为交叉编译
  4. 使用getGnuWin32获取构建库所需的所有工具,将它们放在路径中,然后重新运行pip。它应该成功运行make命令来构建库......如果它能找到源代码。
  5. 所有这些事情(1除外)都需要此库的源代码,这只是进行跨平台业务的一项成本。如果您不喜欢没有Windows版本,那么rsync可能不适合您。

    最后,根据更新here,如果有人想要Windows二进制文件,他们需要联系开发人员,他将构建它们。