I tried to make a cron job on crontab which runs a python script on AWS ec2. My python script includes a module that is only available for python3. Using the following command I changed the ec2 default python interpreter from python2.7 to python3.4 Source /home/ec-2user/venv/python34/bin/activate and then using pip install, I installed the required module for python3.4. So now the default interpreter is python3.4 and when I run the script on ec2-user directory using the following command: python test.py the program runs without any problem (so I am sure the module is installed correctly). But when I assign python file to a cronjob * * * * * python test.py
It does not work. Checking the mail, the error is: “No module found named “xxxxx” “
But as I said it worked fine outside of the cron.
I was wondering if you can help me with this problem. I appreciate your time and information.