简体   繁体   中英

SyntaxError: Non-UTF-8 code starting with '\xca' in file /usr/local/bin/python3 on line 2, but no encoding declared

I am trying to schedule a crontab job to run a python script and referring to python in /usr/local/bin/python3 but getting this error

SyntaxError: Non-UTF-8 code starting with '\xca' in file /usr/local/bin/python3 on line 2

What does this mean and how can I solve it? I can't open the python3 file

you're calling to python twice. Decide which interpreter you want to use and run either:

* * * * * /Users/name/opt/anaconda3/envs/myenv/bin/python /Users/name/Desktop/Scrape/scraper.py

or

* * * * * /usr/local/bin/python3 /Users/name/Desktop/Scrape/scraper.py

I get the exact same error running any program. Yesterday it just worked fine, did not change anything, now this error... extremely frustrating as a complete beginner trying to get into Python.

I do not understand what PyCharm is trying to do with "firstMainn.py", it was an old class that I have deleted already.

How can I run Python only once as ItayB describes above?


/usr/local/bin/python3 /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 /Users/fakeName/PycharmProjects/learningEnvironment/firstMain.py

SyntaxError: Non-UTF-8 code starting with '\xca' in file /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details

Process finished with exit code 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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