强制外壳从SunGrid引擎中的conda变量使用python [英] Force shell to use python from conda variable in SunGrid engine

查看:186
本文介绍了强制外壳从SunGrid引擎中的conda变量使用python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在SunGrid引擎中执行python文件,并且正在从anaconda3环境变量中执行该文件.

I'm trying to execute a python file in SunGrid engine, and I'm executing it from my anaconda3 environment variable.

我的代码很简单:

from __future__ import print_function
import urllib3
import numpy as np

if __name__ == '__main__':
    print('Hellooo')

我这样称呼它:

qsub -V -b n -cwd -pe mp 3 playground.py

但我收到此错误:

from: can't read /var/mail/__future__
import: unable to open X server `' @ error/import.c/ImportImageCommand/358.
/var/spool/gridengine/execd/cluster-rp-02/job_scripts/22924: 3: /var/spool/gridengine/execd/cluster-rp-02/job_scripts/22924: Syntax error: word unexpected (expecting ")")

我在网上寻找错误,并找到了解决方案:

I looked online for the error and I found a solution her: Getting Python error "from: can't read /var/mail/Bio"

建议在python代码的开头添加:#!/usr/bin/env python.

it proposed to add: #!/usr/bin/env python in the beginning of the python code.

我正在使用anaconda3,其中所用python的目的地不同.因此,应为:#!../anaconda3/envs/py3/bin/python

I'm using anaconda3 where the destination of the used python is not the same. So, it should be: #!../anaconda3/envs/py3/bin/python

但是当我添加此脚本时,出现此错误:

But when I add this script I get this error:

/home/master/bin/sge_mp_startup.sh: 10: exec: /var/spool/gridengine/execd/cluster-rp-01/job_scripts/22926: not found

我错过了什么吗?

推荐答案

来自链接的问题:

如果脚本存储在名为script.py的文件中,则必须以python script.py

因此您可以将../anaconda3/envs/py3/bin/python添加到命令行:

So you could add ../anaconda3/envs/py3/bin/python to the command line:

qsub -V -b n -cwd -pe mp 3 ../anaconda3/envs/py3/bin/python playground.py

或者如果../anaconda3/envs/py3/bin/python是路径中的第一个python可执行文件,则可以简化:

Or if ../anaconda3/envs/py3/bin/python is the first python executable in your path, you could simplify:

qsub -V -b n -cwd -pe mp 3 python playground.py

这篇关于强制外壳从SunGrid引擎中的conda变量使用python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆