Pycharm shows "External Libraies" every time i add a new file

Viewed 23

Every time i add a new file to the project, it shown also in "External Libraries" and i had to minimize it.. any way to turn this off and keep "Ex. Libraries" minimized?

Add a new file

The problem

1 Answers

The problem appears to be that your project's working directory is also your virtual environment interpreter's directory.

Typically, when setting up a new project with a virtual environment, the virtual environment directory would be something like
C:\Users\username\.virtualenvs\ProjectName\
and the interpreter would be in the subdirectory
C:\Users\username\.virtualenvs\ProjectName\Scripts\python.exe

Your project's working directory would typically be somewhere completely different, such as
D:\PyCharm Projects\ProjectName\

I believe the following steps should resolve the issue, but maybe make a backup of your current project folder, just in case.

  1. Close any open files in your project workspace
  2. Go to File -> Settings and search for Project Structure (it's under the Project: group)
  3. Click Add Content Root on the right side panel
  4. Find a new folder where you want to put your project. You could create this folder in advance or make it via the pop up.
  5. Close settings, and now both root directories will appear in the Project explorer. Drag and Drop your project folders from the "bad" location to the new one. It may ask if you want to do a Move Refactor, choose Yes.
  6. If desired, go back to settings Project Structure and remove the previous folder as a Content Root.
Related