1

I'm highly confused about this. Python3 is installed per default on the MacBook.

which python3 will output /Library/Frameworks/Python.framework/Versions/3.6/bin/python3

Great, so that's my SDK to put into IntelliJ IDEA, one should think.

I have the Python plugin for IDEA. However, I can't run Python files. So I try to change the configuration and set it to the above PATH for the Python interpreter.

However, still nothing. Trying to run the Python file inside IDEA will prompt a new configuration?

I can run the script just file doing python3 script.py in the terminal? I know the path for the Python3 library, yet, IDEA doesn't recognise it at all and doesn't save the configuration.

What am I doing wrong in this process? This should be fairly easy to set up but turns out it isn't :)

I even tried to create a Python 3.6.2 virtual environment with the IDEA internal tool - same thing? It doesn't allow me to run the Python3 script from inside IDEA.

Should I use python from usr/bin/python? If I cd there, I can see Python3. But inside IDEA, i only have access to Python2..

3
  • You probably should just use JetBrains' PyCharm... Commented Sep 6, 2017 at 8:55
  • No, it's a Java project with some Python scripts in it. Also, the Python plugin in IDEA is basically PyCharn, just a few months behind.
    – cbll
    Commented Sep 6, 2017 at 9:10
  • Ahh, I see. Sorry then, cannot help :( Commented Sep 6, 2017 at 9:12

2 Answers 2

4

After installing Python 3.8.1 via pyenv which I now recommend over using Homebrew (see https://github.com/pyenv/pyenv), I did the following to add this version to IntelliJ IDEA.

  1. Close all open projects. This will display the Welcome to IntelliJ IDEA window listing recent projects along the left.
  2. Click on Configure -> Structure for New Projects
  3. Click on SDKs under Platform Settings along the left
  4. Click on the + sign above the SDK list and select Python SDK
  5. From the Add Python Interpreter window, select System Interpreter
  6. Click on the ... button to the right of the Interpreter drop down and browse to $HOME/.pyenv/versions/3.8.1/bin/python. Replace 3.8.1 with the desired Python version if you want to configure another version.

Updated for IntelliJ IDEA 2019.3.3

3
  • helpful but workflow has changed since 2017.3.x; I'm using 2017.3.4 - but this gets you close. Commented Jun 6, 2018 at 21:53
  • When I am trying to save this, I am getting error: Cannot save settings, please specify a different sdk name.
    – Rose
    Commented Feb 24, 2020 at 10:33
  • Perhaps your copy of IDEA already has a Python SDK configured with the same name?
    – jkwuc89
    Commented Feb 24, 2020 at 13:00
2

Try this in menu of IDEA: File -> Settings -> Project: Name of project -> Project Interpreter and from above in the window you can choice interpreter version or virtualenv.

4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.