My computer: MacBook Air M1 Running 11.6.3 Memory 8GB
Things I have tried:
Reinstalled Visual studio code
Use pyenv to install Python 3.10.2
pyenv install 3.10
pyenv global 3.10
Had brew reinstall pyenv 2.2.4
Also tried command python3.10 -V just reverts back to python 2.7 right away.
Every time I open Visual studio code, to get python 3 to run I must run the two commands below. Just wondering if there is a more permanent solution to the problem. Once I run the command, I have no problems, and can run python programs normally, but the next time I restart Visual studio code, the same issue comes back. Any solution would be helpful... many thanks!!
alias python="python3" # to use python3 rather than python2.7
alias idle="idle3" # to use python3 idle rather than 2.7
Simply running the command python3.10 fixed the problem. I was just using python nameoffile.py to run a program. Not aware that VSC was defaulting to Python 2.7 built into the Mac OS.
python3.10 nameoffile.py
Many Thanks everyone
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.