Search code examples
pythonpycharminterpreter

Python: Correct setup of python interpreter in pycharm


I already installed some packages, all of them are located into following path:

/usr/local/lib/python3.8

After I start a new project in pyccharm the software for some reason gives me the option to choose some interpeters I already installed into my system. So I have choosen the system interpreter located on

usr/bin/python3.8

My problem now is, I need to reinstall all the packages located into the path above. Is there a way to automatically use the packages already installed and if I install a package with pycharm its automatically located into this folder and for future projects its not needed to reinstall it again?


Solution

  • PyCharm can work with multiple Python interpreters and this happens to be the common problem with using the right one. Here are two ways to make that sure.

    First one:

    1. When creating a new project just beneath the location click on the Python interpreter option.
    2. Select the option Previously configured interpreter
    3. Choose the interpreter that has all your installed packages.

    Second one:

    1. If you have already created a project, you need to go the file menu and click the "Settings" option.
    2. On the left pane click on the >Project: and then click on the Python Interpreter option.
    3. Select the the right interpreter from the dropdown and all the packages installed with that interpreter will show in the table below.
    4. Apply and click OK. You are done.

    Now import any package you have already installed and it should be OK