Home

Awesome

How to learn modern Python

A guide to the adventurer<br> <br> Click para versão em Português/Portuguese version <br> <br> First to learn modern Python you have to choose an operating system. The Python is the same in all of them but some settings and the libs used by your future programs may be supported in one OS and not in the other OS. In this guide I focus on the development in Linux and Windows, but the info can also be useful for other operating systems. <br>

See the conda version:

    $ conda -V

Update conda

    $ conda update conda

Create a virtual environment for your project (substitute yourenvname by the name of the environment ex: test_01_proj and the x.x by 3.7 the version of Python in the future environment).

    $ conda create -n yourenvname python=x.x anaconda
    ex: $ conda create -n test_01_proj python=3.7 anaconda

See the environments that were created.

    $ conda info -e

To activate the environment

    $ source activate yourenvname
    ex: $ source activate test_01_proj

or

    $ conda activate test_01_proj

To desactivate an active environment

    $ source activate yourenvname
    ex: $ source desactivate

or

    $ conda deactivate

Install additional Python packages to a virtual environment.

    $ conda install -n yourenvname [package]
    ex: $ conda install -n test_01_proj svgwrite

Delete a no longer needed virtual environment <br>

    $ conda remove -n yourenvname -all
    ex: $ conda remove -n test_01_proj -all
    $ conda install -n test_01_proj -c conda-forge pylint
    $ conda install -n test_01_proj -c conda-forge ctags

If you do all this steps you will have a fair knowledge of Python and can start doing some cool projects in Python. <br>

Have fun! <br>

Best regards,<br> Joao Nuno Carvalho