If you are struggling to set up Pycharm IDE and don't want to install packages for each project separately like me but don't know where to start then this guide is for you. I hope this guide will help you set up Pycharm with global package manager and will make things easy. Let’s get started.
♦ Setting Up JetBrains Pycharm in Linux
Download the Pycharm IDE (www.jetbrains.com/idea/download/) and extract its contents to ‘/opt/’ and install it by running the bellow commands.
sudo tar -xvzf ~/Downloads/pycharm* #extract the files
sudo mv pycharm* pycharm # Rename the folder (optional)
./pycharm/bin/pycharm.sh #Run the installer
Follow the instructions to installer the IDE. Once done, close the IDE and create a file named 'jet-brains-pycharm.desktop' and put below content in it
Finally, run the below command to make a launch icon in your applications' menu.
sudo desktop-file-install jet-brains-pycharm.desktop
♦Setting Up JetBrains Pycharm in Windows
Download the Pycharm IDE from https://www.jetbrains.com/pycharm/download/and follow the instructions to install it.
♦Setting Up Global Package Manager
In this guide, I am setting up global package manager in Linux environment, but similar process can be followed for windows. I am using pipenv as base, you can set it up by running follow commands in terminal.
Note: this guide requires python and pip already installed. If you do not have them, please install them before continue.
pip --version # to check pip installation
pip install --user pipenv # to setup pipenv
Create a new project named global and choose python interpreter: New Pipenv environment.
Next, got to settings > Project: global > Python Interpreter and choose Show All from the dropdown list of python Interpreters.
Click on the + sign to make this project as global package manager. Keep the project location same and base interpreter to your current python version. Make sure you check the Inherit global site-packages and Make available to all projects options and click ok to add it as your python interpreter.
You should be able to see your currently installed packages. We have set up our global package manager now we can click ok and close the project.
Let's test our global package manager by creating a test project. While creating your project choose previously configured interpreter and make sure you choose the location of global package project which we just set up.
If you have followed along and everything went smoothly, you should be able to run your test Project and the output should be similar to the one shown below.
Congratulations! You should have successfully set up Pycharm IDE with global package manager.
Leave a comment below if you have any question or suggestions.
Happy Posting! See you in the next one.