简体   繁体   English

导入python库gedit外部工具时出错

[英]Error importing python library gedit external tools

I am trying to create a shortcut that execute on the selection this simple python code. 我试图创建一个快捷方式,对这个简单的python代码进行选择。 It just run a function from the library Biopython. 它只是从Biopython库运行一个函数。

#!/Users/USERNAME/Library/Enthought/Canopy_64bit/User/bin/python

from Bio.Seq import reverse_complement
import sys

print reverse_complement(sys.stdin.read().rstrip())

But I get this error: 但是我得到这个错误:

ImportError: No module named Bio.Seq

It does not make sense to me since if I run from the terminal 对我来说这没有意义,因为如果我从终端运行

$ /Users/USERNAME/Library/Enthought/Canopy_64bit/User/bin/python
>>> from Bio.Seq import reverse_complement

The library is imported without any problem. 该库已导入,没有任何问题。 What do I do wrong? 我做错了什么? How do I tell gedit where to look for the library? 如何告诉gedit在哪里寻找资料库?

It's a problem with your path. 您的路线有问题。 This should work: 这应该工作:

#!/Users/USERNAME/Library/Enthought/Canopy_64bit/User/bin/python

import sys
sys.path.append('*yourpath of Bio module*')
from Bio.Seq import reverse_complement


print reverse_complement(sys.stdin.read().rstrip())

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM