Anaconda virtual environment configuration Python library and Spyder compiler

This article introduces the installation of third-party libraries for the virtual environment of Python in Anaconda and supporting Spyder and other Software‘s approach.

In the article How to create an Anaconda virtual Python environment, we introduced the method of creating, using and deleting the Python virtual environment in the Anaconda environment; and after creating the virtual environment, You need to configure various libraries and software in the corresponding environment. This article will introduce these operations.

1 Software installation

Here we will introduce the installation of Spyder software as an example. First, we need to open “Anaconda Prompt (anaconda3)” and enter the virtual environment through the conda activate statement; for example, here I enter a file called py36 virtual environment, as shown in the first sentence of code below.

Then, we enter the following code to prepare for downloading the Spyder software.

conda install spyder

Run the code as shown below.

It should be noted here that if we are stuck for a long time in the “Solving environment” link in the picture above, it is mostly due to the fact that the official server of conda is abroad and there is a network connection problem. , so we can solve this problem by changing sources. There are many introductions on the Internet about the specific principles and methods of source replacement. We will directly introduce the specific operation methods here.

First, we enter the following code to view the current path for conda to download various files and data.

conda config --show channels

Run the code as shown below. Among them, defaults indicates that our current conda download of various files, data, etc. is achieved through the default method (that is, the server abroad), so it will indeed Comparative.

Therefore, we enter the following code to modify this default path to an image provided by University of Science and Technology of China.

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/

Run the code. I forgot to take a screenshot here, so I won’t show the screenshot of the result; but at this time we can check the download path of conda through the aforementioned conda config --show channels statement. , you can see that the first one is already the mirror image of the University of Science and Technology of China that we added earlier; as shown in the figure below.

Later, we will download the Spyder software through the aforementioned conda install spyder statement; it will be much faster at this time. After the Spyder software is downloaded, the interface shown below will appear.

At this time, in the Anaconda list of the start menu, we can see that the Spyder software has been downloaded in the py36 environment; not only that , other software or environments supporting the current virtual environment, such as Jupyter QTConsole, etc., have also been configured together.

Of course, because the Python version of my py36 virtual environment is 3.6, the supporting downloads include Spyder, etc. The software is also an earlier version; in this case, if you mind, you can upgrade Spyder or other software through conda update spyder and other similar statements.

2 Third-party library installation

Next, we introduce how to configure third-party libraries in a virtual environment. Similarly, we first enter the corresponding virtual environment and download the required libraries through the conda install statement.

For example, if we need to configure the GDAL library, then enter the following code.

conda install gdal

Run the code as shown below.

The specific process is the same as in the default base environment of Anaconda. You still need to confirm which libraries need to be updated and downloaded, and confirm whether to start by entering y Install as shown below.

After the configuration is completed, we can use the relevant third-party libraries in the current virtual environment. For example, we can open the Spyder software in the py36 virtual environment downloaded in the first part of this article, and then run the code related to the GDAL library.

Digression

In this era of rapidly growing technology, programming is like a ticket to a world of infinite possibilities for many people. Among the star lineup of programming languages, Python is like the dominant superstar. With its concise and easy-to-understand syntax and powerful functions, Python stands out and becomes one of the hottest programming languages in the world.


The rapid rise of Python is extremely beneficial to the entire industry, but “There are many popular people and not many people“, which has led to a lot of criticism, but it still cannot stop its popularity. development momentum.

If you are interested in Python and want to learn Python, here I would like to share with you a Complete set of Python learning materials, which I compiled during my own study. I hope it can help you, let’s work together!

Friends in need can click the link below to get it for free or Scan the QR code below to get it for free

CSDN Gift Package: Free sharing of the most complete “Python learning materials” on the entire network(safe link, click with confidence )

?

1Getting started with zero basics

① Learning route

For students who have never been exposed to Python, we have prepared a detailed Learning and Growth Roadmap for you. It can be said to be the most scientific and systematic learning route. You can follow the above knowledge points to find corresponding learning resources to ensure that you learn more comprehensively.

② Route corresponding learning video

There are also many learning videos suitable for beginners. With these videos, you can easily get started with Python~

③Exercise questions

After each video lesson, there are corresponding exercises to test your learning results haha!

2Domestic and foreign Python books and documents

① Documents and books

3Python toolkit + project source code collection

①Python toolkit

The commonly used development software for learning Python is here! Each one has a detailed installation tutorial to ensure you can install it successfully!

②Python practical case

Optical theory is useless. You must learn to type code along with it and practice it in order to apply what you have learned into practice. At this time, you can learn from some practical cases. 100+ practical case source codes are waiting for you!

③Python mini game source code

If you feel that the practical cases above are a bit boring, you can try writing your own mini-game in Python to add a little fun to your learning process!

4Python interview questions

After we learn Python, we can go out and find a job if we have the skills! The following interview questions are all from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and Alibaba bosses have given authoritative answers. I believe everyone can find a satisfactory job after reviewing this set of interview materials.

5Python part-time channels

Moreover, after learning Python, you can also take orders and make money on major part-time platforms. I have compiled various part-time channels + part-time precautions + how to communicate with customers into documents.

All the above information , if friends need it, you can scan the QR code below to get it for free
?