简体   繁体   中英

Trouble running Python 3+ on Mac OSX Catalina

I am attempting to execute python code on my local computer using VSCode. When I attempt to import numpy, pandas etc, I receive "Unable to import 'numpy' pylint(import-error)".

When I look at "python --version", I receive Python 2.7.16.

Have read a few threads that have included uninstalling Python extension, changing the settings.json files to the path of the python 3.8 and changing the bash_profile to export PythonPath, however when I run the code, the errors return and the version returns to Python 2.7.16.

Any ideas on what I have missed?

First try running from the console, and instead of using

python yourscript.py

which runs python 2, run

python3 yourscript.py

Hope this helps!

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