2017-11-06 3:47 GMT-03:00 Michel Desmoulin email@example.com:
Today I'm going to give a training in Python again.
And again it will go the same way.
On Mac I will have to make people install python, then tell them to use pip3.
On Windows, I will have to warn them about checking the "add python executable to system path" (that one of them will ALWAYS miss anyway). Then tell them to use py -3.x -m pip because some of them will have several versions of Python installed.
Then on linux, I will tell them to install python-pip and python-venv and use python3 -m pip.
I'll talk about --user, but commands won't be usable on some machine where the Scripts or bin dir is not in the system path.
Then I will make them create a virtualenv so that they can avoid messing with their system python and finally can just use "pip install" like in most tutorials on the Web.
And eventually I'll talk about pipenv and conda. The first one so they don't have to think about activating the virtualenv everytime, or pip freeze, or create the venv, or add it to gitignore, etc. The second because anaconda is very popular on windows.
There is no way a beginner is going to get any that by themselves without a lot of time and pain. They will read some tutorial on the web and struggle to make sens of what pip is and why "pip install" doesn't work and why "python sucks".
Do you know about "fades"?
fades is a system that automatically handles the virtualenvs in the cases normally found when writing scripts and simple programs, and even helps to administer big projects. It will automagically create a new virtualenv (or reuse a previous created one), installing the necessary dependencies, and execute your script inside that virtualenv, with the only requirement of executing the script with fades and also marking the required dependencies.
It works in linux, mac and windows. So your only thing to do for students to run projects inside virtualenvs with X and Y dependencies is to `fades -d X -d Y script.py`, in all environments.