User Tools

Site Tools


programming:python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
programming:python [2017/08/04 08:56] – created skipidarprogramming:python [2024/04/14 16:13] (current) – [Virtual environments] skipidar
Line 1: Line 1:
 ===== Python ====== ===== Python ======
  
-=== Install on Wndows ===+==== Install on Wndows ====
  
-== Package Manager PIP ==+== Installing python ==
 Python (instead of Active Python, which adds enterprise support) Python (instead of Active Python, which adds enterprise support)
 <code> <code>
Line 11: Line 11:
  
  
-== Package Manager PIP ==+== INstalling package manager PIP ==
 <code> <code>
 # download get-pip.py from here https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip # download get-pip.py from here https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip
Line 18: Line 18:
 </code> </code>
  
-Then add the following location to the environment variable Path. There "pip" is located. <br>+Then add the following location to the environment variable Path. There "pip" is located. \\
 <PATH-TO-PYTHON>/Scripts  <PATH-TO-PYTHON>/Scripts 
 +
 +== Use package maanger to install plugins ==
 +<code>
 +# restart the shell after updating the PATH and execute for example
 +pip install boto3
 +</code>
 +
 +== Configure IDE ==
 +Istall Intelij community edition: \\
 +https://www.jetbrains.com/idea/download/#section=windows
 +
 +Install the Python plugin:
 +https://stackoverflow.com/documentation/intellij-idea/8069/how-to-install-plugins#t=201708040815183841111
 +
 +Start a new Python Project.
 +
 +Validate your Project uses Interpreter from your Python installation. \\
 +https://www.jetbrains.com/help/idea/configuring-python-interpreter-for-a-project.html
 +
 +Create a new *.py file
 +
 +<sxh py>
 +import json
 +import logging
 + 
 +import boto3
 + 
 +...
 +</sxh>
 +
 +
 +==== Learn Python ====
 +
 +https://learnxinyminutes.com/docs/python/
 +
 +
 +==== Async with Python ====
 +
 +https://www.heise.de/hintergrund/Asynchrones-Programmieren-async-minus-await-7527129.html
 +
 +
 +==== Virtual environments ====
 +
 +==What is a Virtual Environment?==
 +
 +A virtual environment is an isolated directory that contains its own Python interpreter, libraries, and packages. It allows you to manage project dependencies independently, preventing conflicts with other projects or system-wide Python installations.
 +
 +
 +<sxh shell>
 +# create the virtual environment
 +python3 -m venv .venv
 +
 +# activate it
 +source .venv/bin/activate
 +
 +# this should point to the python binary in your virtual environment
 +which python
 +
 +# install dependencies in the virtual env
 +python -m pip install -r requirements.txt
 +</sxh>
 +
programming/python.1501836962.txt.gz · Last modified: (external edit)