DEV Community

Dr. Azad Rasul
Dr. Azad Rasul

Posted on

3- How to create environments and install Python packages?

Click on start in Microsoft. Then, select: Anaconda Prompt (miniconda 3).

Image description

Your miniconda opened with the base environment.

List of commands in conda available here

To show packages already installed into the environment we can use:

conda list
Enter fullscreen mode Exit fullscreen mode

Image description

To show environments of miniconda use:

conda env list
Enter fullscreen mode Exit fullscreen mode

The output is:

Image description

Create new environment:

In this learning series, we create and use a new environment "da35" with Python version 3.5:

conda create --name da35 python=3.5
Enter fullscreen mode Exit fullscreen mode

Tip:

Not all Python libraries available for all Python versions. We prefer Python 3.5 for data analysis so we named it da35.

Go to your newly created environment "da35":

conda activate da35
Enter fullscreen mode Exit fullscreen mode

Tip:

(Every time when you start working inside this environment you have to activate it because libraries you installed inside it not available to base and other environments.)

Install packages:

We have some commands to install libraries such as "conda", "pip".

Tip:

(Before installing packages, you have to activate the environment that you like the packages install within.)

For instance, to install NumPy (scientific computing) and seaborn (statistical data visualization) packages we use:

conda install numpy
pip install seaborn
Enter fullscreen mode Exit fullscreen mode

If you like the content, please SUBSCRIBE to my channel for the future content.

To get full video tutorial and certificate, please, enroll in the course through this link: https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7

Top comments (0)