如何在virtualenv中安装pyatspi?

时间:2018-03-08 11:52:34

标签: python gnome

我正在尝试在virtualenv中运行dogtail examples。我的virtualenv目前看起来像这样:

$ pip freeze
dogtail==0.9.9
ruamel.yaml==0.15.35
vext==0.7.0
vext.gi==0.6.8

但是当我尝试运行一个示例时,我收到一条错误消息pyatspi缺失:

$ python appstartup.py  
Traceback (most recent call last):
  File "appstartup.py", line 9, in <module>
    from dogtail.procedural import *
  File "/home/username/.local/share/virtualenvs/nmtest/lib/python3.6/site-packages/dogtail/procedural.py", line 5, in <module>
    from dogtail import rawinput
  File "/home/username/.local/share/virtualenvs/nmtest/lib/python3.6/site-packages/dogtail/rawinput.py", line 6, in <module>
    from pyatspi import Registry as registry
  File "/home/username/.local/share/virtualenvs/nmtest/lib/python3.6/site-packages/vext/gatekeeper/__init__.py", line 204, in load_module
    raise ImportError("No module named %s" % modulename)
ImportError: No module named pyatspi

我已经拥有python3-pyatspiinstalled,但显然无法从我的virtualenv中访问它。 &#34; pyatspi&#34;不会出现在PyPI上,但我have found source code。如何在我的virtualenv中安装pyatspi?

1 个答案:

答案 0 :(得分:1)

由于您的软件包在PyPI上不可用,您需要使用系统软件包(包括已安装的pyatspi)创建virtualenv:

var str="This is the number I want +2143334 !, again this is the next number I want +234343443 !, last number I want +76645 !, fininshed";
var m,results = [];
var rx = /want\s*(\+\d+)/g;
while(m=rx.exec(str)) {
  results.push(m[1]);
}
console.log(results);

另一个选择是“独家”包含pyatspi包

$ virtualenv --system-site-packages foo
$ source foo/bin/activate

根据您的环境,命令/路径可能略有不同。 为了找到pyatspi lib的路径 - 启动python shell(没有激活的virtualenv),导入模块并检查module_name。路径。 e.g。

$ virtualenv --no-site-packages foo
$ source foo/bin/activate
$ ln -s /usr/lib/python3/dist-packages/pyatspi* $VIRTUAL_ENV/lib/python*/site-packages