在 Subversion 的文档中有一个从 Python 使用 Subversion 的示例
#!/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
那么,如何安装这个库呢?