python开发环境简介
Welcome! This is your first step towards learning Python programming language. Or, Do you know this language already and are here just to revise your concepts?. It doesn't matter which category you belong to because we will be teaching you Python, right from the basics.
欢迎! 这是您学习Python编程语言的第一步。 或者,您是否已经知道这种语言,并且只是在这里修改您的概念? 属于哪个类别都没有关系,因为我们将从基础知识开始教您Python。
An experienced programmer might have an advantage of picking up topics and lessons rather quickly, even though we recommend you to not to hurry through the topics, since Python, although being a normal programming language, carries some nice treats for programmers, and you would not want to miss those in the tutorials.
经验丰富的程序员可能会很快地选择主题和课程,即使我们建议您不要急于完成主题,因为Python虽然是一种普通的编程语言,但对程序员来说却是一种不错的享受,而您不会想错过这些教程。
For all the noobs out there, there is nothing to worry. You should be happy that you have chosen the most amazing and simple tutorial to learn Python.
对于那里的所有菜鸟,没有什么可担心的。 您为选择了最出色且最简单的Python学习教程感到高兴。
为什么选择Python? (Why Python?)
Python is considered as one of the most versatile programming languages. If you have even a little experience in programming, then you will soon notice the difference. Let's take a look at the features of Python.
Python被认为是最通用的编程语言之一。 如果您甚至没有一点编程经验,那么您很快就会注意到其中的区别。 让我们看一下Python的功能。
Python的功能 (Features of Python)
It has simple easy-to-use syntax.
它具有简单易用的语法。
It can run on almost any platform including Windows, Linux's all distros(All versions of Linux), Mac OS X, Unix etc.
它可以在几乎所有平台上运行,包括Windows,Linux的所有发行版(Linux的所有版本),Mac OS X,Unix等。
You can even combine the pieces of other programming languages like C, C++, etc with python to utilize the best of both worlds.
您甚至可以将其他编程语言(如C,C ++等)与python结合使用,以充分利用两者的优势。
It's large standard library support makes real life programming much easier.
它的大型标准库支持使现实生活中的编程变得更加容易。
Other than that, it's open source, and have a huge community support working actively with Python programming.
除此之外,它是开源的,并且拥有大量社区支持,可以积极地与Python编程一起工作。
It's Object Oriented (also called OO Programming or OOP) which makes it more applicable to be used in real world application programming.
它是面向对象的(也称为OO编程或OOP) ,使其更适用于现实世界的应用程序编程。
Also, it can not only be used to write complex programs but can also be used to design applications with GUI(Graphical User Interface).
而且,它不仅可以用于编写复杂的程序,还可以用于使用GUI(图形用户界面)设计应用程序。
Python is an Inerpreted language, as its the Interpreter which executes the python code line by line, which makes it easier to debug. But it is a topic of never ending discussion that is Python compiled? Well, technically it is, from user written code to bytecode, and the bytecode is then sent to the Interpreter to execute it. Here is a good StackOverflow discussion over this: Is Python interpreted, or compiled, or both?
Python是一种不懂语言的语言,因为它是解释器,可以逐行执行python代码,因此调试起来更容易。 但是,Python编译是一个永无休止的讨论主题吗? 从技术上讲,从用户编写的代码到字节码 ,然后将字节码发送到解释器以执行它。 这是有关此问题的一个很好的StackOverflow讨论: Python是解释的还是编译的,还是两者兼而有之?
Python has numerous implementations like CPython(The Standard implementation of python), Jython(Targeted for integration with java programming language) etc.
Python有许多实现,例如CPython (Python的标准实现), Jython (旨在与Java编程语言集成)等。
As far as its simplicity of syntax is concerned, let's see an example code. Consider a program where you want the user to enter something from the keyboard and you want to save that value in a variable. For C++, a popular programming language, here is how you will be writing it:
就其语法的简单性而言,让我们看一个示例代码。 考虑一个程序,您希望用户从键盘上输入一些内容,并将该值保存在变量中。 对于流行的编程语言C ++ ,这是您将如何编写它:
#include<iostream>
using namespace std;
int main(){
int x;
cin >> x;
return 0;
}
For Core Java, another popular programming language, it will be:
对于Core Java (另一种流行的编程语言),它将是:
import java.util.Scanner;
class Test{
Scanner input = new Scanner(System.in);
public static void main(String args[]){
int x;
x = input.nextInt();
}
}
And in Python
, it is (*drum roll*):
在Python
,它是(* drum roll *) :
x = input()
No kidding. That's all it will take. No file importing, no curly braces, no semicolons and just one line. It's really not necessary to understand that code piece right now. It was just meant to demonstrate you that how Python can be a programmer's relief.
别开玩笑了 这就是全部。 没有文件导入,没有花括号,没有分号,只有一行。 确实没有必要立即了解该代码段。 它只是为了向您展示Python如何成为程序员的后援。
Another thing that can be noticed in above code is, in the case of C++ and Java user can only type any integer
as the input to variable x
, because we have declared value x
as an integer by specifying the code: int x;
. In case of Python, programmers don't have to explicitly specify the data type while declaring a variable, python's compiler will do that itself, based on the type of value assigned to the variable.
在上述代码中还可以注意到的另一件事是,对于C ++和Java用户,只能输入任何integer
作为变量x
的输入,因为我们通过指定代码将值x
声明为整数: int x;
。 对于Python,程序员在声明变量时不必显式指定数据类型,而python的编译器会根据分配给变量的值的类型自行进行声明。
关于课程的一些事情 (Few things about the course)
To be precise there are currently two releases of Python that are available on their official website i.e., Python 2.x and Python 3.x. In this course we will be dealing with Python 3.x
确切地说,目前在其官方网站上有两个Python版本,即Python 2.x和Python3.x 。 在本课程中,我们将处理Python 3.x
Also, there is not too much difference between Python 3.x and Python 2.x, the major change is in the way how you print anything. It was just print
in Python 2.x and in Python 3.x they made it print()
, yes added the brackets.
而且,Python 3.x和Python 2.x之间并没有太大的区别,主要的变化在于您打印任何内容的方式。 它只是在Python 2.x中print
,而在Python 3.x中,他们将其设置为print()
,是的,加上了括号。
Python的应用 (Applications of Python)
One can say, you can do almost anything with Python.
可以说,Python几乎可以做任何事情。
Web Application: Python can be used to develop scalable and secure web applications. Frameworks like Django, Flask, Pyramid etc are amazing to design and develop web based applications.
Web应用程序 :Python可用于开发可扩展且安全的Web应用程序。 像Django,Flask,Pyramid等框架对于设计和开发基于Web的应用程序来说都是很棒的。
Computer Software or Desktop Applications: As python can be used to develop GUI too, hence it is a great choice for developing desktop applications.
Tk
is an open source widget toolkit which can be used to develop desktop applications with python.Kivy
is another such platform.计算机软件或桌面应用程序 :由于python也可以用于开发GUI,因此它是开发桌面应用程序的绝佳选择。
Tk
是一个开源小部件工具包,可用于使用python开发桌面应用程序。Kivy
是另一个这样的平台。
Scientific Computing Application: For its amazing computational power and simple syntax, python is used for scientific computing applications. Python libraries like
SciPy
andNumPy
are best suited for scientific computations.科学计算应用程序 :python具有出色的计算能力和简单的语法,因此可用于科学计算应用程序。
SciPy
和NumPy
等Python库最适合科学计算。
AI and ML(Artificial Intelligence and Machine Learning): Python is at the fore front of the paradigm shift towards Artificial Intelligence and Machine Learning.
AI和ML(人工智能和机器学习) :Python处于向人工智能和机器学习转变的最前沿。
Image Processing: Python is known for its image processing capabilities, which includes traversing and analysing any image pixel by pixel. There are numerous python libraries available for image processing, for example: Pillow, scikit-image etc.
图像处理 :Python以其图像处理功能而闻名,该功能包括逐像素遍历和分析任何图像。 有许多用于图像处理的python库,例如:Pillow,scikit-image等。
Starting with something that you might already be using: Websites like Instagram, Reddit, Mozilla, have been developed using Python. There are various web frameworks like Django
(most popular one) and Pyramid
, based on Python, which can be used to develop modern web applications.
从您可能已经在使用的东西开始: Instagram , Reddit , Mozilla等网站已使用Python开发。 有多种基于Python的Web框架,例如Django
(最受欢迎的一种)和Pyramid
,可用于开发现代Web应用程序。
安装Python (Installing Python)
Steps to set up Python environment in your Windows system:
在Windows系统中设置Python环境的步骤:
Go to python.org/download
Download the latest release for Python 3.x for 32-bit or 64-bit depending upon your PC.
根据您的PC,下载适用于32位或64位的Python 3.x的最新版本。
Open Installer and follow these steps:
打开安装程序,然后按照以下步骤操作:
Click on Next, once you have checked the selected options in the window.
在窗口中选中所选选项后,单击“下一步”。
Once these steps had been followed, the installation will begin.
完成这些步骤后,将开始安装。
You can check whether the installation was successful by typing
python -V
in cmd. If it returns the Python version that you have installed, then congratulations you're all set.您可以通过在cmd中键入
python -V
来检查安装是否成功。 如果它返回您已安装的Python版本,那么恭喜您已准备就绪。
If you have a Macbook, the MacOS comes pre-loaded with Python 2.7.x but you cannot update the version or add module in pythona>, as its required by the operating system. So you should download Python 3 and setup virtual environment in Macbook.
如果您有Macbook ,则MacOS预先装有Python 2.7.x,但是您无法根据操作系统的要求更新版本或在python a>中添加模块 。 因此,您应该下载Python 3并在Macbook中设置虚拟环境 。
If you use Ubuntu operating system, it comes pre-loaded with Python.
如果您使用Ubuntu操作系统,它将预装Python。
翻译自: https://www.studytonight.com/python/getting-started-with-python
python开发环境简介