12

I'm using Pycharm Community 2018.1.4 on Linux Mint 19 Tara Xfce.

It works well with Python 3.5 interpreter. I installed Python 3.7 to be the default Python interpreter on the system.

python -V command returns Python 3.7.0b3 I would like to use Python 3.7 in Pycharm.

I've tried :

which python

/usr/bin/python

which python3.7

/usr/local/bin/python3.7

When I go to File > Settings > Project and Interpreter > Add and there is no /usr/local folder and there is no python3.7 in /usr/bin

I can cd to /usr/local/bin folder in the terminal, but Pycharm just can't. I restarted, uninstalled/reinstalled Pycharm, refreshed its inner browser, restarted my pc. Nothing changed.

What am I missing?

nbro
  • 15,395
  • 32
  • 113
  • 196
Cépagrave
  • 189
  • 1
  • 2
  • 12

6 Answers6

12

You will need to add the interpreter to the list of available interpreters.

Use which python to find out the path of the interpreter, then in the Settings > Project Interpreter > Add > System Interpreter window hit the "..." button and add that interpreter. (The screenshot below is from macOS, but it should be the same on Linux.)

enter image description here

AKX
  • 152,115
  • 15
  • 115
  • 172
  • Thanks for your answer, I tried that already: the path is /usr/bin/. But there's no python3.7 there – Cépagrave Jul 25 '18 at 11:01
  • 1
    If you run `python -V` and get "Python 3.7.0b3", a subsequent `which python` will tell you which executable prints that. It doesn't need to be called `python3.7` to be Python 3.7. – AKX Jul 25 '18 at 11:55
  • My nose tells me that my problem is more related to linux than to pycharm ... Don't you think ? – Cépagrave Jul 25 '18 at 12:13
  • 2
    If you can `cd /usr/local/bin` in a shell, it does exist. PyCharm is a little slow on the uptake for file system changes on occasion though – there's that refresh button in the file/directory selector in PyCharm... – AKX Jul 25 '18 at 12:33
  • I can cd /usr/local/bin from shell and python3.7 is there. I refreshed the file/directory selector, restarted the pc, refreshed again, and still can't reach /usr/local/bin from Pycharm ... – Cépagrave Jul 25 '18 at 13:33
  • 2
    So basically my problem is: Pycharm is unable to reach the '/usr/local/' folder. It doesn't appear in the File/Open browser either. – Cépagrave Jul 25 '18 at 15:24
6

I had the same issues with Pycharm Community Edition 2020.1, Linux Mint 19.3.

For reasons I don't know, the Flatpak version, which is only provided in Linux Mint's repositories can't see and access most of the directories which are beyond the user's home.

Pycharm 2020.1 Flatpak comes with a Python 3.7 interpreter, which seems to live in the virtual environment, located in the user's home. I tried to change for the default python3 compiler of Linux Mint 19.3, which is version 3.6 and lives in /usr/bin - no chance, neither by navigating with Pycharm's file browser, nor by copy and paste to the path field.

Strangely also most of the directories e.g. below /usr/lib weren't displayed.

I then installed Pycharm via a ppa (alternative package repository for some Linux flavors), to be specific this one

Voilà! Any installed interpreter is accessible and can be selected.

11dur
  • 61
  • 1
  • 3
  • 1
    Thanks for the hint! I had the same issue with Pycharm Community Edition 2022.2, Pop!_OS 22.04 LTS. The default software manager Pop!_Shop has installed the Flatpak version. Installing Pycharm via JetBrains Toolbox App has solved the issue. – tharndt Aug 12 '22 at 13:09
1

How do you launch Python3.7 in terminal? For example, you use python3.7 to launch.

Then you can which python3.7 to find where it is.

And then add that path to your Pycharm's Python Interpreter.

Sraw
  • 18,892
  • 11
  • 54
  • 87
1

if you already have 3.7 installed. right click and run Pycharm as admin. then it should display, and install the new packages.

GIxxxer
  • 11
  • 1
0

In flatpak-version PyCharm you can found host-os files in this directory:

/var/run/host/

For example:

/var/run/host/usr/bin/python3.8

But this is a bad way. It is better to install from the ppa.

strannik-j
  • 99
  • 2
  • 6
0

use ctrl + alt + s to open interpreter the select the one you wanted to use that is for the environment you have chosen. If you wanted to change the interpreter for the environment the go to the interpreter settings after pressing the ctrl + alt + s and select the environment interpreter.