Python找不到模块
我正在尝试在我的服务器(主机/共享托管)上运行网络抓取脚本,它们使用名为 virtualenv 的东西(我做了一些研究,它令人困惑......)。不过,我确实安装了运行 Selenium 和其他一些进程所需的软件包。我已经通过运行以下命令检查了它们是否已安装:
$ pip show selenium
它返回 Location: /home/s49674/virtualenv/python/3.9/lib/python3.9/site-packages
但是,当我运行 python 时代码,它给了我模块未安装的错误。
我要做的就是通过ssh激活virtualenv,并通过ssh调用python脚本。但这不允许我通过 cronjob 自动执行脚本。你知道这个问题的解决办法吗?到目前为止我还没有找到任何有效的东西。无论我将 python 脚本存储在哪里,它都找不到模块。
I'm trying to run scripts for webscraping on my server (host/shared hosting) and they use something called virtualenv (I've done some research and its confusing...). However, I did install the required packages for running Selenium and some other processes. I have checked that they are installed by running the command:
$ pip show selenium
Which returns Location: /home/s49674/virtualenv/python/3.9/lib/python3.9/site-packages
However, when I run my python code, it gives me the error that the module is not installed.
What I have to do is to activate the virtualenv through ssh, and call the python script through the ssh. But this doesn't allow me to automate script execution through cronjob. Do you know a solution to this? So far I haven't found anything that works. It doesnt matter where I store the python script, it cant find the modules.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论