在Subversion的documentation有使用Subversion从Python的Python的颠覆包装库
#!/usr/bin/python
import svn.fs, svn.core, svn.repos
def crawl_filesystem_dir(root, directory):
"""Recursively crawl DIRECTORY under ROOT in the filesystem, and return a list of all the paths at or below DIRECTORY."""
# Get the directory entries for DIRECTORY.
entries = svn.fs.svn_fs_dir_entries(root, directory)
当我运行这段代码,我得到一个导入错误的例子:
$ python crawl.py
Traceback (most recent call last):
File "crawl.py", line 7, in <module>
import svn.fs, svn.core, svn.repos
ImportError: No module named svn.fs
这意味着我失踪了库svn
。我试图安装这个软件包,但是Python软件包管理器找不到它。
$ pip install svn
Downloading/unpacking svn
Could not find any downloads that satisfy the requirement svn
No distributions at all found for svn
那么,我该如何安装这个库?
是不是有点古怪,它抱怨'svn.core'但不是' svn.fs'(后者首先在导入列表中)? – NPE
你抓到我了,我复制并粘贴了在交互式提示符下运行'import svn.core'的错误 –