天天看点

使用Python如何访问svn做二次开发

在linux下使用python可以通过svn的hook进行二次开发。

但是,如果要使用python访问svn的API (from svn import fs, repos),需要安装相关包,否则出现如下错误:找不到svn包

[email protected]:/usr/lib/python2.7# python

Python 2.7.3 (default, Apr 20 2012, 22:44:07)

[GCC 4.6.3] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> from svn import fs

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

ImportError: No module named svn

解决办法: 安装python-subversion。按照如下操作。

apt-get install python-subversion

注: apt-get是Ubuntu在线安装软件的工具,其相关配置方法见

http://happycool.blog.51cto.com/6045742/1004819

转载于:https://blog.51cto.com/happycool/1006108