在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'的錯誤 –