python cgi模块 失败_当我从网上运行CGI脚本时,为什么python无法找到某些模块?...

I have no idea what could be the problem here:

I have some modules from Biopython which I can import easily when using the interactive prompt or executing python scripts via the command-line.

The problem is, when I try and import the same biopython modules in a web-executable cgi script, I get a "Import Error"

: No

module named Bio

Any ideas here?

解决方案

Here are a couple of possibilities:

Apache (on Unix) generally runs as a different user, and with a different environment, to python from the command line. Try making a small script that just prints out sys.version and sys.prefix, and compare the result through apache and via the command line, to make sure that you're running from the same installation of python in both environments.

Is Biopython installed under your home directory, or only readable just for your normal user? Again, because apache generally runs as a different user, perhaps you don't have access to that location, so can't import it.

Can you try doing import site before trying to import Biopython? Perhaps something is preventing site packages from being imported when you run through apache.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值