Experiment 1 Anaconda installation and use (Python programming experiment report)

 

Experiment 1 Anaconda installation and use

1.Experimental environment

Python integrated development environment IDLE/Anaconda

2. Experimental purpose

1. Master the installation and configuration of Anaconda under Windows.

2. Master the simple use of Anaconda under Windows, including the use of IDLE, Jupyter Notebook, and Spyder tools.

3. Master the use of pip to manage Python extension libraries, including downloading, online installation, offline installation, upgrade, and uninstallation of extension libraries.

3. Experimental content

1. Download Anaconda.

2. Install and configure Anaconda

3. Use IDLE that comes with Anaconda.

4. Use Spyder that comes with Anaconda.

5. Use the Jupyter Notebook that comes with Anaconda.

6. Use the pip/conda tool to manage Python third-party extension libraries.

4. Experimental steps

1. Install and configure Anaconda

2. Use IDLE that comes with Anaconda

3. Using Spyder IDE

4. Use Jupyter Notebook to write and run Python source code

5. Mix graphics, text and formulas in Jupyter Notebook

6. Use pip to manage Python third-party extension libraries

7. Modify Jupyter default workspace

5. Experimental results

1. Writing and running Jupyter Notebook source code

  1. Writing code using Spyder IDE

3. Use pip to manage Python third-party extension libraries

(1) The command used to upgrade pip is as follows.

python -m pip install --upgrade pip

(2) View all extension libraries currently installed under Anaconda. The command used is as follows, and the running effect is as shown in the figure

pip list

(3) Display detailed information of an expansion package. For example, to display detailed information of the numpy package, the command used is as follows

pip show numpy

(4) Uninstall an expansion pack. For example, to uninstall the numpy package, use the following command:

pip uninstall numpy

(5) Install an expansion package online. For example, to install the numpy package, use the following command:

First, try installing pytest-cov and pytest-filter-subpackage separately. Execute the following command:

pip install numpy

4. Mix graphics, text and formulas in Jupyter Notebook

Select the unit type [markdown].

Figure 1-16 Set cell type to markdown

Markdown is a lightweight markup language that allows people to write documents in a plain text format that is easy to read and write.

files. Text can be edited in Markdown mode. Using Markdown's syntax specifications, you can set the text format, insert links, pictures and even mathematical formulas. Similarly, you can run the Markdown unit and display the format by pressing the [shifit] + [enter] key combination. ized text.

Add a "#" character and a space before the first line to represent the first-level title, add two "##" characters and a space to represent the second-level title, and so on. Bullets can use "+", "-", "*" plus spaces. The formula is enclosed by two "$" symbols before and after it. For example, the inline formula: "$E=mc^2$", the single-line formula: $$E=mc^2$$

Complete the following input:

Figure 1-17 Enter markdown text

6. Problems encountered during the experiment and their solutions

Problem 1 and solution

使用python -m pip install --upgrade pip安装时候出现DEPRECATION: pyodbc 4.0.0-unsupported has a non-standard version number. pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of pyodbc or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at Issues · pypa/pip · GitHub

Baidu later discovered that the problem is: when executing this command, you may see a warning message similar to DEPRECATION. This is because the version number of pyodbc does not comply with the PEP 440 specification. It is recommended to change the version number to a version number that conforms to the specification. It should be noted that although there is a warning message, it does not affect the use and installation of other packages.

As you can see from the output, pip is already installed in the environment and is at version 23.2.1. However, it should be noted that the warning message indicates that the version number of pyodbc does not comply with the specification.

So as far as installing pip is concerned, the operation was successful. If you want to resolve the warning message, you can try upgrading or changing the version of the pyodbc package. You can try upgrading by executing a command similar to pip install --upgrade pyodbc.

Upgrade by executing pip install --upgrade pyodbc operation. The upgrade results are as follows:

Problem 2 and solution

The following error occurs when executing pip install numpy operation

Baidu later discovered that the reason was: a dependency conflict error was encountered during the installation of numpy. Specifically, pytest-astropy 0.8.0 requires pytest-cov>=2.0 and pytest-filter-subpackage>=0.1 to be installed, but they are not installed.

To resolve this issue, you can perform the following steps:

First, try installing pytest-cov and pytest-filter-subpackage separately. Execute the following command:

pip install pytest-cov pytest-filter-subpackage

The above command successfully installed pytest-cov and pytest-filter-subpackage, then try to install numpy again:

pip install numpy

Based on the output, it can be seen that the numpy package has been successfully installed before. A warning message is prompted in the output, that is, the version number of pyodbc does not comply with the specification. This is because the installed pyodbc version is 4.0.0-unsupported. It is recommended to upgrade to a new version or contact the author to release a version number that conforms to the specification.

In summary, the numpy package has been successfully installed.

Guess you like

Origin blog.csdn.net/VLOKL/article/details/134367906