简体   繁体   English

在 Mac OSX Catalina 上运行 Python 3+ 时出现问题

[英]Trouble running Python 3+ on Mac OSX Catalina

I am attempting to execute python code on my local computer using VSCode.我正在尝试使用 VSCode 在我的本地计算机上执行 python 代码。 When I attempt to import numpy, pandas etc, I receive "Unable to import 'numpy' pylint(import-error)".当我尝试导入 numpy、pandas 等时,我收到“无法导入 'numpy' pylint(导入错误)”。

When I look at "python --version", I receive Python 2.7.16.当我查看“python --version”时,我收到 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. 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运行 python 2,运行

python3 yourscript.py

Hope this helps!希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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