Pycharm: Virtual Environment

Version: 
Pycharm 2024.1.4
Python 3.11.9

The Python project relies heavily on libraries. To manage various projects and versions, it is recommend to use a virtual environrment. Here are the instructions for creating a virtual environment in Pycharm.

1. Project Interpreters

File --> Settings --> Project: pythonProject --> Python interpreters --> Add


2. Add Local Python Environment

Virtualenv Environment --> New Environment --> Set Location, Base interpreter 

  • Location: Select an empty folder. This folder will be the location of the Python virtual environment. The Python installed by PyCharm will be placed in this folder.
  • Base Interpreter: Use the global Python folder?
  • Inherit Global Site-Packages: If you select this option, the base interpreter and third-party libraries in the global environment can be used by the virtual environment. If not, only the packages in the virtual environment will be available.
  • 3. Apply virtual environment.

    In the terminal command window, commands beginning with (venv) indicate that the program is now running in a virtual environment.

    Next Post Previous Post
    No Comment
    Add Comment
    comment url