Python 3.X

Python 3

install python

Just download and install from main website of python.

Set environment Variables

  1. open "environment Variables"

  2. set at System Variables New variable "PYTHONPATH"

  3. Add paths like on first screen

  4. Create on Variable Path (System variables) a new variable named %PYTHONPATH%

  5. The Paths of PYTHONPATH will be use in Path by %PYTHONPATH%

Add paths to python
%PYTHONPATH%

At command prompt / powershell just try command to check if python is correctly installed

python -V >Python 3.8.5

Pycharm (IDE)

Install Pycharm

Download and install Pycharm Community version - it is for free.

Create first project

File > New Project 1. set a location and new folder name 2. set a New environment (it's better option, because sometimes we forgot to tell someone what to install in his environment to this project could be work)

Create a new project with new environment on Python 3.8

Install pip to Python Interpreter

  1. File > Settings

  2. Project: "gitbookProject" > Python Interpreter

  3. Click "+" icon > to install

to install package

4. search and install package

Install selenium package

5. Package 'selenium' installed successfully

Pip and Venv by console

Package manager

pip is the reference Python package manager. It’s used to install and update packages. You’ll need to make sure you have the latest version of pip installed.

py -m pip install --upgrade pip

Virtual environment

Virtual environment is used to manage Python packages for different projects. Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip.

Creating a venv

py -m venv env

(we could do it by pycharm by option New environment)

Activating a virtual environment

.\venv\Scripts\activate

Leaving a virtual environment

deactivate

Pip install

e.g. selenium

pip install selenium

How to use venv and pip

requirements.txt

Save all the packages in the file

pip freeze > requirements.txt

Install packages from file requirements.txt

pip install -r requirements.txt

>
Requirement already satisfied: selenium==3.141.0 in c:\users\nn\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 1)) (3.141.0)
Requirement already satisfied: urllib3==1.25.10 in c:\users\nn\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 2)) (1.25.10)

Last updated

Was this helpful?