Python 2.6在Ubuntu上导入包(psyco)

时间:2013-03-24 21:49:04

标签: python linux bash psyco

为什么在我直接调用我的脚本时导入psyco工作,但是当我从bash脚本调用它时它会失败???

test.sh:

while true
do
    python test.py;
    sleep 10;
done

test.py:

try:
    import psyco
    print "Got psyco!"
except ImportError:
    print "No psyco."

现在......

> python test.py

“得到了psyco!”

> ./test.sh

“没有psyco。”

“没有psyco。”

...

1 个答案:

答案 0 :(得分:0)

此系统上安装了2个版本的Python。

不同的环境正在调用不同版本的python,它没有psyco。