Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Celery use wrong python version

I have a Django project, and I want to use Celery. I've installed Celery for python3, and then I run this command : sudo celery -A myApp worker -l info

But in the log, I see that it's Celery of python2.7 which is used : File "/Library/Python/2.7/site-packages

Any idea how for me to use the Celery installed for python3 ?

like image 815
JulienBlc Avatar asked Mar 24 '26 00:03

JulienBlc


1 Answers

Ok, thanks to @Wayne I've found the solution.

First, use this command to see where the head of celery is : head -n 10 /usr/local/bin/celery For myself, this is what I get :

#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'celery==3.1.23','console_scripts','celery'
__requires__ = 'celery==3.1.23'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('celery==3.1.23', 'console_scripts', 'celery')()
    )

I see that the first shebang (#!/usr/bin/python) use the wrong python version.

Then, I've changed the first shebang : #!/usr/bin/env python3 and save the file. Now celery point to python3.

like image 84
JulienBlc Avatar answered Mar 25 '26 13:03

JulienBlc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!