Windows 7 和 Python 使用 rsync
我想用一个Python模块来开发,它使用rsync进行通过SFTP和webdav的文件传输。我找到一个叫pysync的库(还有其他的库)。但是我在Windows 7上,使用的是VisualStudio 2010,可是构建的时候失败了……因为出现了“问题”。
所以我想知道有没有人知道适用于Windows、MacOS和Linux的可用librsync或者其他类似的东西,因为我需要跨平台的支持。
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 个回答
1
你真的非得用rsync吗?你现在是用SFTP来传文件,所以paramiko可能对你有帮助。如果你确实需要一个能用的librsync,你还有几个选择。
- 找一个已经编译好的版本来安装(希望你的搜索能力强...)
- 安装cygwin,下载源代码,运行make install,记得把选项改成适合Windows的设置。
- 把源代码下载到一个Linux系统上,然后设置交叉编译。
- 使用getGnuWin32来获取构建这个库所需的所有工具,把它们放到你的路径中,然后重新运行pip。这次应该能成功运行make命令来构建库...前提是它能找到源代码。
除了第一种方法,以上所有方法都需要这个库的源代码,这就是跨平台开发的一个成本。如果你不喜欢没有现成的Windows版本,那可能rsync就不适合你。
最后,根据这里的更新,如果有人想要Windows的二进制文件,需要联系开发者,他会为你构建。