What can python do?

statement

The purpose of this article is to introduce how many fields Python can be used in, how easy it is to use, what toolkits are available, and to do a simple science on Python's related management environment and integrated development environment , there is no content suitable for brainless configuration operations according to the picture. If you need this kind of content, you may need to search on csdn. The main purpose of this article is to expand the field of vision.

(But about the process of Python installation and how to use it later? I still talked about it roughly)

Thousand-character long text, close up~

What are the uses of python?

Python is a high-level programming language that is widely used in a variety of different fields. Following are some common uses of Python:

  1. Web application development: Python can be used to write web applications, APIs, crawlers, web servers, and more.

  2. Data Science and Machine Learning: Python has many popular data science and machine learning libraries, such as NumPy, Pandas, SciPy, Scikit-learn, etc., which can be used in data analysis, machine learning, artificial intelligence and other fields.

  3. Automation and Scripting: Python can be used to script and automate tasks such as automated testing, batch processing, file manipulation, etc.

  4. Game development: Python can be used to write games and game engines, such as Pygame, Panda3D, etc.

  5. Scientific computing and engineering computing: Python can be used to write scientific computing and engineering computing programs, such as finite element analysis, computational fluid dynamics, etc.

  6. Financial analysis: Python can be used for financial data analysis and quantitative transactions, such as pandas-datareader, pyfolio, etc.

  7. Education and popular science: Python is easy to learn, so it is widely used in the field of education and popular science, such as programming introduction, drawing, etc.

In short, Python is a general-purpose, flexible, and easy-to-learn programming language, so it has a wide range of applications in various fields.

First, I need to have a python environment...

Method 1, install Python from the official website.

This method is simple and rude, first you need to learn a little magic (kxsw, go to github to find one, free and paid ones are fine, github can be successfully boarded through green acceleration) (of course you can not use magic, but the download speed is extremely slow , and then you need to spend a little effort to replace the download source with Tsinghua source or Ali source (but in fact, you need to change the proxy to use magic, which requires a little technology))

The advantage of this method is that it is easy to understand and can be installed wherever you want, and it is lightweight. The disadvantage is that if you forget to set the global path, it is very likely that there will be 3 to 5 more pythons on a computer in the end, and the installation The above Python is light, you need to use pip to install related software, which is relatively error-prone

Method 2, Anaconda

This method needs to log on to Anaconda's official website, download Anaconda from it, and install it locally after downloading. If you find it troublesome to set the path, remember to check when installing: Help me set global variables, so that you can use it from cmd The advantage of evoking Anaconda is that it is easy to install, and when this software is installed, its default library helps you integrate a series of data analysis software, and the entire Anaconda wants to build a Python ecosystem, so you can install other through the main interface of Anaconda The disadvantage of Python auxiliary software is that Anaconda is heavy and difficult to handle. It takes more than three minutes to open a main interface, and it consumes computer memory.

Method 3, miniconda

The cut version of anaconda only keeps one conda and one Python. If you find it troublesome to configure the global path, and you don’t want to accidentally install several more minicondas, you can choose to directly check Help me when installing the package interface Set the environment variable option. The advantage is that it is lightweight and has most of the functions that we usually use method 2. The disadvantage is that the installation interface is in English (in fact, method 2 is also) and relatively unfriendly to novices (but it is actually okay?)

Method 4: Project management library + python

如果你对包管理软件和项目管理软件已经有非常成熟的理解了,这种情况下你可以使用Python支持的一些包管理库,例如poetry等,他们会使用类似于java中maven的形式,来帮你管理Python中的库,这对于项目化和工程化是相当有帮助的。缺点是对于几乎没有接触他们的新手而言,使用这个简直就是地狱级难度。

等等,我为什么需要给python准备一个包管理软件?包管理软件到底是什么?

Python包管理软件是用于管理Python软件包(也称为库或模块)的工具。这些软件包是预先编写好的Python代码,可以在你的应用程序中被导入和使用,以完成特定的任务。

Python包管理软件的作用是:

  1. 管理Python依赖项:Python应用程序通常依赖于许多软件包和库。包管理软件可以自动安装、升级和卸载这些依赖项,以确保应用程序可以正常运行。

  2. 管理Python环境:在Python中,每个项目都可以使用不同的版本和依赖项。包管理软件可以帮助你管理这些版本和依赖项,以确保项目的环境是正确和一致的。

  3. 管理Python发布:如果你创建了一个Python软件包,包管理软件可以帮助你发布和分发这个软件包,以便其他人可以使用它。

常见的Python包管理软件包括pip、conda、easy_install等。这些工具都可以通过命令行使用,使得Python的包管理变得更加容易和高效。

如果我偏不用会怎么样?

如果你不使用Python包管理软件,可能会遇到以下问题:

  1. 版本冲突:Python软件包通常有许多不同的版本,这些版本可能不兼容。如果你手动安装软件包,可能会遇到版本冲突的问题,导致你的应用程序无法正常运行。

  2. 依赖项管理:Python应用程序通常依赖于许多软件包和库。如果你手动安装这些软件包,可能会遗漏某些依赖项,导致应用程序无法正常运行。此外,如果你需要更新依赖项,手动更新也会非常麻烦。

  3. 维护困难:手动管理Python软件包和依赖项会非常困难和耗时。如果你的应用程序依赖于很多软件包,手动管理它们将会变得非常麻烦和容易出错。

  4. Difficulty publishing: If you create a Python package and want to distribute it for others to use, manually publishing and distributing it can also be very difficult and time-consuming.

Therefore, using Python package management software can help you automatically manage Python packages and dependencies, making Python development more efficient and easier to maintain.

Concept: Dependency Conflict

Dependency conflict is a very simple concept. For example: now there are two main libraries in your Python environment, one is called A and the other is called B. A and B depend on the same version of C at the same time.

(Note that the same version, and two different versions of the library cannot exist in one environment), and all three of ABC are Python libraries.

Now that b has been updated, you plan to update b, but after b is updated, the dependency on c becomes higher.

To put it bluntly, a higher level of c must be required to support the operation of b (if it was version 1.0 before, now c must be version 3.0 or 4.0, similar to this understanding).

But a cannot support higher c versions

(For example, if a supports up to 2.0, when b is updated to 3.0 or 4.0, a will not be supported)

In this case, there will be a dependency conflict for the b update (b can be used but a cannot be used), especially when using pip, pip will not perform environment checks, so it will install it for you without any explanation before installation. The situation may cause other libraries in the environment to be unusable.

Concept: Package Conflicts

A package conflict is when two or more packages are installed in the same Python environment

These packages depend on different versions of the same package or there are version incompatibilities between dependent packages.

This situation is like your friends and your family are scheduling you at the same time, because their schedules conflict and you can't accommodate everyone's needs.

Package conflicts may prevent Python programs from running properly, or produce unexpected results, such as program crashes or incorrect results.

To avoid this problem, you can use a Python package management tool to manage packages and dependencies, or use virtual environments to create independent Python environments, ensuring that each application has its own packages and dependencies, avoiding different programs. conflicts between packages.

It’s like you assign each friend and family member their own schedule, making sure everyone’s needs are met and avoiding conflict and confusion.

Concept: Virtual Environment

A virtual environment is a mechanism for creating an independent Python environment. It allows you to run multiple Python environments on the same machine at the same time without interfering with each other. You can install different versions of Python interpreters, packages, and dependencies. Virtual environments are often used to resolve dependency conflicts between different projects, upgrade Python versions, test software packages, and more .

Probably means:

In a bunch of Python environments, there is the largest Python, which is usually used for package management, not as a development and production environment.

We can use this largest Python interpreter, combined with some package management libraries, to generate a new environment, or delete an environment, or activate an environment.

After you activate a new environment, you can call the relevant installation instructions and modification instructions of package management in it to change the library installed in this environment, and this library will not interfere with other environments.

The creation and management of virtual environments can be done through Python's built-in venv module or third-party tools such as virtualenv. Here are the steps to create a virtual environment using the venv module:

  1. Open a command line terminal or console, and go to the directory where you want to create a virtual environment.

  2. Run the following command to create a virtual environment called myenv:

    python -m venv myenv
    ```
    This will create a new folder called myenv in the current directory, containing a new Python environment.
  3. Activate the virtual environment. On Windows, you can run the following command:

    myenv\Scripts\activate.bat

    On Linux or Mac, you can run the following command:

    source myenv/bin/activate

    This will activate the virtual environment and change the command line prompt to the virtual environment name.

  4. Install packages and dependencies in a virtual environment. You can use the pip command to install any packages and dependencies you need.

When you need to exit the virtual environment, you can run the following command:

deactivate

This will close the virtual environment and change the command line prompt back to what it was.

Using a virtual environment can help you efficiently manage Python packages and dependencies, ensuring that dependencies between different projects do not conflict. Virtual environments also help you easily upgrade your Python version and test packages.

Creating a virtual environment using conda can be done with the following steps:

  1. Open a command line terminal or console, and go to the directory where you want to create a virtual environment.

  2. Run the following command to create a virtual environment called myenv:

    conda create --name myenv
    ```
    This will create a new virtual environment called myenv.
  3. Activate the virtual environment. On Windows, you can run the following command:

    activate myenv

    On Linux or Mac, you can run the following command:

    source activate myenv
  4. Install packages and dependencies in a virtual environment. You can use the conda command to install any packages and dependencies you need.

  5. When you need to exit the virtual environment, you can run the following command:

    deactivate

    This will close the virtual environment and change the command line prompt back to what it was.

Using conda to create a virtual environment can help you effectively manage Python packages and dependencies, ensuring that dependencies between different projects do not conflict. conda also helps you easily upgrade your Python version and test packages. In addition, conda can also manage non-Python packages and dependencies, making the entire environment more unified and easy to manage.

Time to prepare an IDE

IDE is the abbreviation of Integrated Development Environment (Integrated Development Environment), which is a software tool designed to provide developers with a complete set of development tools and environments to facilitate the development and debugging of software applications. IDE usually includes multiple functions such as a code editor, debugger, compiler, auto-completion, version control, construction tools, graphical user interface design tools, etc., so that developers can perform code writing, testing, debugging, and so on in the same software. Build, run, and deploy multiple tasks.

The main advantage of the IDE is to improve development efficiency and code quality, because it provides many powerful functions, such as code auto-completion, syntax checking, code refactoring, debugging tools, etc., so that developers can write code faster and discover and Fix bugs. In addition, the IDE also provides many integrated tools and plug-ins, making it easier for developers to use version control systems, automated build tools, and other auxiliary tools.

There are many common IDEs for Python, including:

Python Integrated Development Environment (IDE)

  1. PyCharm: The Python IDE developed by JetBrains has powerful functions, supports code auto-completion, debugging, version control and other functions, and is suitable for various fields of Python development. The disadvantage is that sometimes the drawing thing can’t be used because the internal terminal crashes. Learning its shortcut operation requires a certain operation curve, and the professional version needs to be paid, so you have to go through some special channels (I mean student certification, really. It's not a pj method) (But it is undeniable that this thing is indeed the best IDE in the industry)

  2. Visual Studio Code: A lightweight code editor developed by Microsoft, which supports Python language extensions, supports code auto-completion, debugging, version control and other functions, and is a very popular Python development tool. The disadvantage is that this thing is too lightweight, and it is not very comfortable to use anyway (this thing is good for typing front-end code)

  3. Spyder: A Python IDE based on the Anaconda distribution. It is powerful and supports multiple functions such as code auto-completion, debugging, and data visualization. It is suitable for scientific computing and data analysis. The disadvantage is that there is a mysterious bug in the input of this product, which has not been fixed so far, and it is slow to open, and the optimization is also uncomfortable

  4. IDLE: The IDE that comes with Python is easy to use and supports basic functions such as code editing and debugging. The disadvantage is that this thing is so simple and easy to use that it has no additional functions in many aspects, and it will not give you code completion, but the above three IDEs all have code completion functions.

Recommend pycharm

Advantages of the Python Integrated Development Environment (IDE):
  1. Powerful functions: Python IDE usually includes multiple functions such as code editor, debugger, compiler, auto-completion, version control, construction tools, GUI design tools, etc., which can improve development efficiency and code quality.

  2. Convenient development: Python IDE can automatically complete code, provide code refactoring, syntax checking and other functions, so that developers can write code faster and find and fix errors.

  3. Versatility: The Python IDE also provides a number of integrated tools and plugins for easy use of version control systems, automated build tools, and other auxiliary tools.

Disadvantages of Python Integrated Development Environment (IDE):
  1. High learning cost: Python IDEs usually have many functions, so it takes a while to get familiar with and master them.

  2. Occupies a lot of resources: Python IDE usually needs to take up more system resources, such as memory and CPU, so it needs a higher computer configuration.

  3. High price: Some Python IDEs need to be paid for, such as PyCharm and so on.

as well as:

Interactive Data Analysis Environment (IDE)

  1. Jupyter Notebook: A web-based interactive Python environment that supports multiple elements such as code, Markdown text, and data visualization, and is suitable for data analysis and exploratory programming.

  2. Notebooks of various online platforms (all jupyter kernels anyway)

Advantages of the Interactive Data Analysis Environment (IDE):
  1. Good interactivity: The interactive data analysis environment allows users to write codes, run codes, and view results in one interface, which is very convenient for data analysis and exploratory programming.

  2. Data visualization: Interactive data analysis environments often include data visualization tools to facilitate users to quickly understand and present data.

  3. Open source and free: Most interactive data analysis environments are free, such as Jupyter Notebook, etc.

Disadvantages of Interactive Data Analysis Environment (IDE):
  1. Relatively weak functions: Interactive data analysis environments usually only provide basic code editing, debugging, running and result viewing functions, not as rich in functions as Python IDEs.

  2. Limited applicability: The interactive data analysis environment is primarily intended for data analysis and exploratory programming and is not suitable for other areas of Python development.

  3. Difficult to debug: Interactive data analysis environments usually do not support full debugging functions, such as breakpoint debugging, etc.

Recommended...just one, nothing to recommend (I heard that a competitor came out recently, but it is still developing. The biggest competitor of this thing is the integrated development environment with AI)

Rich people's choice: github codespace, now added to the chatgpt code support package

What is Chatgpt?

If you are a computer practitioner:

"??????????????", "What are you doing, hey~"

If you are a non-computer practitioner:

When we talk to another person, we can express ourselves in natural language, and the other person can understand our words and respond. ChatGPT is a computer program that can simulate the way humans talk, that is, you can have a conversation with ChatGPT, and it will understand your words and respond to you. Similar to when you have a conversation with a person, if you ask a question, he will answer you according to the meaning of the question and his knowledge. ChatGPT has a wide range of applications and can be used in intelligent customer service, chat robots and other fields to allow people to obtain information and services more conveniently.

Think of ChatGPT as a very thick encyclopedia that covers a wide variety of knowledge and information and can answer various types of questions. Just as we can find information about history, geography, science, culture, etc. when we read an encyclopedia, ChatGPT can also handle various natural language tasks and provide relevant answers or generate new texts.

The knowledge range of ChatGPT is very wide because it uses a large amount of language data during training, including news, encyclopedias, novels, web pages, etc. This is like when we read an encyclopedia, we can obtain knowledge and information from various fields. Although ChatGPT also has some limitations, for example, its answers may not be accurate or complete for very specific or specialized fields, but in general, its knowledge range is very broad, and it is constantly expanding and improving.

Next:

In the following sections I will show you the sheer number of toolkits available for Python

  • Automation and Scripting

    • excel, word automation

      • openpyxl

      • python-docx

    • file batch processing

      • os

      • shutil

    • reptile

      • beautiful soup(bs4)

      • requests (network responsibility, underlying material)

      • scrapy

      • selenium

      • lxml

      • pyquery

      • Requests-HTML

      • ......

  • Data Science and Computing

    • data science computing

      • Matrix operations: numpy

      • Various scientific calculations: scipy

      • High precision: decimal

      • Symbolic computing: Sympy

      • ......

    • data analysis

      • The only true god of pandas

      • polar: ??? (faster, but not widely used)

      • spark: ??? (industrial boss)

      • ......

    • and its visualization

      • matplotlib

      • plates

      • pychart

      • seaborn

      • plotly

      • bokeh

      • altair

      • ......

    • machine learning

      • scikit-learn and its derivatives

    • deep learning

      • computer vision

        • opencv,pytorch,tf-keras,paddlepaddle

      • natural language processing

        • Various word segmentation software: jieba, nltk, spacy, snownlp, stanford-corenlp

        • pytorch,tf-hard,paddlepaddle

      • (Of course not only these two fields, but let’s talk about these two first)

  • System Management and Operations

    • Log processing: logging

    • Backup management: shutil, tarfile, paramiko

    • Monitoring alarms: psutil, smtplib

    • Automatic deployment: paramiko, tarfile, shutil, os

    • ......

  • Web Development and Web Applications

    • Three-piece set of Django, Flask, and Bottle

    • streamlit lightweight rapid development

  • game development

    • Pygame

    • PyOpenGL

    • panda3d

    • Pyglet

    • Arcade

    • 。。。。。。

What, not enough?

Find a domestic agent and ask chatgpt.

Guess you like

Origin blog.csdn.net/unrealnum_border/article/details/131599324