0

我正在尝试从 Python 提示符运行 qblast,在导入我需要的所有库后,Python 找不到我的文件:

>>> record = SeqIO.read(open("sinchimeras_1.fasta"), format="fasta")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'sinchimeras_1.fasta'

我试图写下文件的所有路径(“/Users/imac ...”)并将文件移动到 Python 和 Biopython 文件夹,我得到了相同的消息。

我必须在哪里保存我的文件?我究竟做错了什么?

4

1 回答 1

0

您需要将该文件移动到您的工作目录或使用绝对路径。

这个问题与 Biopython 无关;IOError 来自open("sinchimeras_1.fasta").

解释

当您为 Python 提供相对路径“sinchimeras_1.fasta”时,它会在当前目录中查找此类文件。因此,不要将您的 Fasta 文件移动到 Python/Biopython 文件夹,而是确保它位于您的工作目录中(os.getcwd()可能会有所帮助)。

或者,您可以提供文件的绝对路径来代替“sinchimeras_1.fasta”(例如open("/Users/imac.../sinchimeras_1.fasta"))。

于 2012-09-18T01:50:15.063 回答