简体   繁体   English

使用python,tensorflow在cron中启动工作的.sh脚本时出现问题

[英]Problem launching working .sh script in cron using python, tensorflow

I have a working script.sh python /opt/facenet/src/train.py . 我有一个正在工作的script.sh python /opt/facenet/src/train.py When I try to launch it in cron I get this error: ImportError: No module named tensorflow . 当我尝试在cron中启动它时,出现以下错误: ImportError: No module named tensorflow I've tried this solution to find tensorflow location like this: import tensorflow tensorflow.__file__ /home/user/anaconda3/lib/site-packages/tensorflow/__init__.pyc So I've changed the path to the libraries, executed like this: /home/user/anaconda3/lib/site-packages /opt/facenet/src/train.py and got the following mistake: /home/user/anaconda3/lib/site-packages: Permission denied . 我已经尝试过这种解决方案来找到这样的tensorflow位置: import tensorflow tensorflow.__file__ /home/user/anaconda3/lib/site-packages/tensorflow/__init__.pyc因此,我更改了库的路径,如下: /home/user/anaconda3/lib/site-packages /opt/facenet/src/train.py并出现以下错误: /home/user/anaconda3/lib/site-packages: Permission denied I tried to fix it in many ways: chmod x+u and so on. 我试图通过多种方式修复它:chmod x + u等。 But I still get the same mistake. 但是我仍然遇到同样的错误。 Any ideas on how to fix it? 关于如何解决它的任何想法?

Check this thread link . 检查此线程链接 Apparently, downgrading Tensorflow solves it. 显然,降级Tensorflow可以解决此问题。

pip3 uninstall tensorflow-gpu
pip3 install --upgrade tensorflow-gpu==1.4

Note: Make sure you're doing this in the environment you use to run the scripts. 注意:确保在用于运行脚本的环境中执行此操作。

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

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