简体   繁体   English

python 脚本 ImportError:在 Automator 中运行 shell 脚本时没有名为“webbot”的模块

[英]python script ImportError: No module named 'webbot' when running shell script in Automator

I have a shell script action that has the following command:我有一个 shell 脚本操作,它具有以下命令:

python /Users/my_name/Desktop/webbot/do_something.py

but I get the following error:但我收到以下错误:

Traceback (most recent call last): File "/Users/my_name/Desktop/webbot/do_something.py", line 1, in <module> from webbot import Browser ImportError: No module named webbot

I've ran this python script manually and it works fine, but in Automator I keep hitting this error.我已经手动运行了这个 python 脚本,它工作正常,但在 Automator 中我一直遇到这个错误。 Both pip and python versions are 3.6. pip 和 python 版本均为 3.6。

Edit:编辑:

The python script python 脚本

蟒蛇脚本

The shell script + traceback of error message shell 脚本 + 错误信息的回溯shell脚本+错误信息的回溯

I have checked where pip installs my packages and webbot is with all the other ones.我已经检查了 pip 安装我的包的位置,并且 webbot 与所有其他包一起安装。 I tried importing other packages in the python script and running it in Automator and packages like matplotlib work fine.我尝试在 python 脚本中导入其他包并在 Automator 中运行它,并且像 matplotlib 这样的包可以正常工作。

Turns out that Automator doesn't use python 3.6 by default and therefore it wasn't able to find the modules pip installed in the 3.6 folder.事实证明,Automator 默认不使用 python 3.6,因此无法找到安装在 3.6 文件夹中的模块 pip。 Following this link's answer Specify which version of Python runs in Automator?按照此链接的答案指定哪个版本的 Python 在 Automator 中运行? it shows how you specify to Automator which python version to use before then running the python script.它显示了在运行 python 脚本之前如何向 Automator 指定要使用的 python 版本。

暂无
暂无

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

相关问题 在 shell /bin/bash 中运行 Python 3 脚本时 Automator 出现 importError - importError in Automator while running Python 3 script in shell /bin/bash ImportError:在Raspberry Pi上运行python脚本时,没有名为“ azure”的模块 - ImportError: No module named 'azure' when running python script on Raspberry Pi 在crontab中运行python脚本时出现“ ImportError:没有名为praw的模块”错误 - “ImportError: No module named praw” error when running python script in crontab 运行 python 脚本会产生: ImportError: no module named termcolor - Running a python script produces: ImportError: no module named termcolor 尝试运行 Python 脚本时出现“ImportError: No module named” - "ImportError: No module named" when trying to run Python script crontab Python 脚本中的“ImportError: No module named requests” - “ImportError: No module named requests” in crontab Python script 运行python脚本时出现ImportError - ImportError when running python script AH01215:ImportError:没有名为PIL的模块:-从apache2配置运行时,python脚本无法识别PIL - AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config Python 'No module named ...' 当 php 使用 shell_exec() 执行脚本时 - Python 'No module named …' when script is executed by php with shell_exec() 在JMeter中运行Python脚本时出现模块ImportError - Module ImportError in running Python Script in JMeter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM