-1

Before I start, I have done a lot of search about this particular issue I got and it could be I didn't search well.

I'm trying to import libraries that I previously installed using pip3 such as pandas and NumPy... to my PyCharm project and I can't find out how to do it.

All I have found is that I can install them again. I don't want to install all of the libraries again, thank you in advance for helping me out.

Edit #1: is it possible to add an entire local folder to the external libraries?

LazyOne
  • 158,824
  • 45
  • 388
  • 391

1 Answers1

2

Using a new virtual environment

I recommend that you create a virtual environment for your project. That will isolate your project's dependencies from your system-wide Python installation. PyCharm should propmt you to do so when you create a new project. Otherwise:

  1. Go to Settings > Project > Project Interpreter, click the cog button and select Add... Add interpreter
  2. Select New environment. The default settings should be fine. Click OK.
  3. Make a list of the packages you want to install in a file requirements.txt in your project's root directory, with one on each line, and then run pip install -r requirements.txt from the PyCharm terminal


Existing interpreter

If you prefer to use an existing interpreter, though, you can also use it from PyCharm without recreating it. Any packages you have installed with that interpreter will ve available without reinstalling.

First, make sure that your Python interpreter in which you installed all your packages is available in PyCharm. Follow step 1. above, but replace step 2. with

  1. Select Existing environment. Click the three dots to locate your python interpreter in your file system. Click OK.

Then, once the interpreter is added, make sure to select it in Settings > Project > Project Interpreter, or use the interpreter menu in the bottom-right corner:

PyCharm interpreter quick menu

Anakhand
  • 2,838
  • 1
  • 22
  • 50
  • basically i have to install them all over again, right? – HorseMAN AKA PLAGUE Jun 30 '20 at 10:23
  • @HorseMANAKAPLAGUE Not necessarily; if you know where the python interpreter where you installed the packages is, you can add it to PyCharm and all its packages will be available. See the second section. – Anakhand Jun 30 '20 at 10:31