Anaconda + Jupyter Notebook development environment setup, really fragrant!

Click “like” to see, form a habit, wechat public account search [JackCui-ai] to follow this programmer who loves to send technology dry goods. In this paper, making github.com/Jack-Cheris… Has been included, a line of large factory interview complete test sites, information and my series of articles.

There are a variety of online tutorials, and the ones most teased by readers are all about how to build a development environment.

For xiaobai, the development environment construction, is the first pass.

I remember when I was learning Python as a kid, one of my favorite things to do was mess with the development environment.

There were too many twists and turns and too much time wasted before the first few lines of code were written.

I also played around with ides, Eclipse, Pycharm, Sublime Text, and more.

After a few weeks of messing around, the code doesn’t write much, and eventually it says “Hello World”.

As an “algorithmic brick remover” who has worked for two years, I would like to talk about how to build the development environment for “future big bull” and “small white” today.

In the future, if a friend asks you to build the environment, the article is directly sent to him, tell him that this tutorial is really sweet!

Environment set up

As we all know, Python is a scripting language with rich third-party libraries.

Python comes with many official libraries that you can use directly, such as RE, OS, Math, and so on.

But the third party library needs to be installed by ourselves.

For example, a normal person is born with eyes, nose, mouth and so on. This is the “official library”.

If you want to buy a nice dress or hair, you have to install it yourself. This is a third-party library.

Python provides a plethora of powerful third-party libraries.

We built the development environment to give Python a variety of capabilities to meet our needs.

Many third-party libraries are individual or team libraries that are not officially developed by Python, so there is a lot of clutter.

Sometimes, there are even conflicts between different versions of the library.

This library is incompatible with that one, and all kinds of “nonsense” errors emerge endlessly.

Once and for all, the solution to or avoiding these problems is to build a “robust” development environment.

Solution: Anaconda + Jupyter Notebook.

Good maintenance, good installation, good you me or everyone is really good.

1, Anaconda,

Anaconda is the tool for managing the third library and supporting “multiple open”.

You can create multiple virtual environments with Anaconda.

What you mean?

A virtual environment is like a person:

Train Xiao Wang to be a mathematician, responsible for matters related to mathematics.

Train Xiao Li as a linguist, specializing in language related matters.

This applies to the virtual environment:

I created a lot of virtual environments.

Base is a base environment for installing Anaconda. The rest are independent environments created according to their own needs.

For example, an environment called Jack is a general-purpose development environment. An environment called Faceswap was built specifically for face-swapping because its dependencies conflict with some common third-party library packages.

Anaconda is also cross-platform and can be installed on Windows, MacOS, and Linux.

2, Jupyter Notebook

Why not recommend a Jupyter Notebook like Pycharm?

Because Jupyter is easy to install and easy to use, it can run on a variety of platforms.

After work, running algorithms are often run on the server.

Can you use Pycharm on a server that doesn’t even have an art interface?

Jupyter Notebook is a Web-based interactive computing Notebook environment.

You can even take notes while you study. Text editing is in Markdown format, and you can insert mathematical formulas.

And because Jupyter Notebook is web-based, you can start the service on the server side, open the web page on your PC, and run all the server-side code.

If you’re an algorithm, crawler, and beginner in Python who doesn’t have to do a lot of Python engineering, don’t hesitate to use Jupyter Notebook.

3, installation,

The benefits of Anaconda + Jupyter Notebook are universal.

So, how do you install it?

Download from Anaconda

www.anaconda.com/products/in…

Select an installation package based on your environment:

Installation is simple, foolproof next step.

After Windows is installed, manually add environment variables.

During the installation of Linux and MacOS, you are prompted whether to set environment variables.

Windows environment variables need to be set in computer -> right mouse button -> Properties -> Advanced System Settings -> Environment Variables ->Path.

D:\Anaconda is the Anaconda installation directory. Add the following two addresses to the Path.

D:\Anaconda

D:\Anaconda\Scripts
Copy the code

Once configured, you can use Anaconda to set up the environment in CMD or Anaconda Prompt.

Input instruction:

conda create -n your_name jupyter notebook
Copy the code

Create a virtual environment named your_name with the additional installation of the Jupyter Notebook third-party library.

You can change your_name to your own preferred name, which is the name of your virtual environment, for example jack.

Then, type y to install:

Once installed, you can view the existing environment by using the conda info -e command.

As can be seen from the figure above, there are two environments, one is Base, which comes with its own base environment, and the other is our newly created environment named Jack.

Once the environment is installed, we can activate the Jack environment using the command:

As you can see, our environment has changed from Base to Jack.

From there, you can install any third-party libraries you want, such as Requests.

For packages that conda cannot find, you can also install using PIP:

python -m pip install xxx
Copy the code

After the third-party library is installed, run the following command to open the Jupyter Notebook:

The effect is as follows:

Create a new notebook:

After entering the code, press Ctrl + Enter to run the program:

The Jupyter Notebook uses a virtual environment called Jack.

If you want to install Pytorch, you can install it in this virtual environment.

conclusion

The Anaconda + Jupyter Notebook environment is ideal for beginners.

Jupyter Notebook is also a powerful tool for learning algorithms and analyzing data.

If you like this kind of tutorial, repost, like, support a lot of people, we will continue to post some tips on how to use these tools.

I’m Jack Cui and we’ll see you next time.

This article will be updated continuously. You can find it on our wechat official account by searching [JackCui-ai]. GitHub github.com/Jack-Cheris… Welcome Star.