1.1 Why learn Python
(1) Python open source supports multiple systems:
Linux
Windows
Mac
(2) Python website:
http://www.python.org
(3)
Does the OPS need to learn to develop? Do you need to learn python? What is the difference between Python and shell?
at this stage, mastering a development language has become a high-level operations engineer of the necessary energy, will not be developed, you can not fully understand the business process of your system, you can not help debug, optimize the development of human development programs, developers sometimes pay little attention to performance problems, these problems have to be done by OPS personnel, A business on-line, resulting in high CPU usage, memory consumption is too large, if you do not develop, you may only find the process level, that is, which process consumes so much, then? And then to the developers to deal with, so how to reflect your value?
In addition, the larger companies, servers are hundreds of, thousands, even tens of thousands of units, in this case how to do automated operation and maintenance? Write a script for loop with Shell? Oh, rest, the shell is also suitable for simple system management work.
to complex automation tasks, you have to use a dedicated development language. You may have said that automation management has specialized open source software monitoring also has, the direct use is good, but the existing open source software such as puppet, Saltstack, OpenStack, Zabbix, Nagios and so on is common software, cannot completely apply your company's all needs, What do you do when you need to make a custom, two-time development? Looking for the development department?
Development departments do not understand the actual operational logic, write out of the things too bad can not be used, I also do the operation and maintenance system, 6 years of operational experience, the first version of the development of the same rotten, this is still understand the operation of business logic, let developers to do, run may be more, That's why I've seen a lot of companies develop their own operations platforms and finally throw that away.
second, will not be operational development, you can not write your own operation and maintenance platform complex operations and maintenance tools, all to find some open source software to patchwork together, if so, please do not complain about your low salary, your work is not valued, saying that someone else on Facebook a OPS engineer tube 20,000 machines, OPS Engineer Annual salary of a hundred thousand of USD, you think someone is covered? Which is not great talent, the development of operations and maintenance both?
Why do you learn python?
Python first is a very cow B scripting language, to meet the vast majority of automated operation and maintenance needs, but also can do the backend C/s architecture, and can use the web framework to quickly develop a high-speed web interface, only when you have the ability to make a set of operation and maintenance automation system, your value is reflected, You are qualified to talk to your boss about it, otherwise, go back and install the machine honestly.
DevOps development Why use Python?
Good question, why not Php,java, C++,ruby, here I can only say, see people see Wisdom, if you happen to have mastered in addition to Python other languages, then you love use what, if you are not even the shell is not written to understand the novice, want to learn a language , please use Python, for what?
First of all, PHP is the most than Python, in fact, they do not have to compare, why? Two languages applicability is different, PHP is mainly suitable for web development, can quickly make small and medium-sized, lightweight web sites, but back-end, basic or other languages, with what language? The Shell? Python? Oh. And Python, is a comprehensive language, both front and back can be, single take out than the Web, also a little less than PHP, but why the web direction of PHP than Python to fire?
Preconceptions, PHP 90 's birth is to do the web, Python2000 years after the advent of the web framework, but on the degree of excellence, Python's web framework basically out of its left, at least with PHP.
What about Java? Well, a bloated, mean, Hao no new language, or honestly use it to do ERP bar, make a transport Wilianping platform, with Java really no need, in my opinion, Java is a stable middle-aged man, stable, mature, bald, and Python represents the youth, concise, fast, clean, handsome!
C++/C, this well, I can only say, if you will be Python, and C, then you will be more popular, but not C, in fact, there is no major obstacle, basically do the operation of the people, to engage in C is to install B, because most of the situation you can not see the level of the system's underlying source, However, if you learn Python, it is recommended that you learn C + +, after all, compared to the dynamic language of Python, C + + efficiency is much higher, but for beginners, not recommended as the first language to start learning, why? Fight self-confidence ... Oh, you know.
Ruby, small Japanese developed, also good, style and python a bit like, because Ruby onrails out of the name, foreign use of more, domestic, rest assured, no, Python has its imagination of the space has been accounted for dead.
Of course, there is a new language go, some operations to see the development of the people to go, also want to join in the fun, think is the future, I want to say, do not blindly follow the trend, go again success, will not become operational development language.
Some people think that python efficiency bottom, said he can not support multi-threading, OH, OK, this is a little bit right, but I want to ask, see me this article has a few have done search engine development? How many concurrent Web sites do you develop for billions of PV?
How many have seen the Linux kernel source code? If not, please don't blindly follow the biography, know why Python does not support multithreading? This sentence is wrong, in fact, Python supports multi-threading, but does not support multi-CPU multi-threading, that is, a program spawn out of multithreading can only occupy a CPU, but why? Oh, because Gil,gil is something, please self-brain ... But do you have to use multithreading? You can use multi-process Ah, then cow b you can also use the association, these python support is very good ah, if your program logic is not good, a multi-threading will not get up.
I know a doctor told a sentence, I feel good, he said, the program efficiency, 80% is the person who wrote the program decided, the language itself accounted for 20%, so the next time someone say that python efficiency is low, please let him go back to check their own procedures more how much useless logic, loops and so on. The Doctor himself wrote a Python Web program, a server can handle billions of requests per day, a second concurrency of nearly 20,000, what web framework so bull B? Don't ask who it is, it's called Tornado.
Can python teach itself?
Of course, what can be self-taught, the premise is that you have to learn will, see more than N rookie on the Road of self-study, his mother can learn anything, what do you do with the university? Do you have a turtle at home?
It is very easy to say that Python is a scripting language, you can see it will not be, say that there are only two kinds of people, one is a master, one is SB, for the master, he must have been other languages, Python in this case, self-study of course it is easily learned, a few years ago when I first contact Python, Code encountered problems, found a development of the Buddies to help debug, the man helped tune for more than 10 minutes to fix, the result of someone else before a Python code has not written, why, because the language has the same place, a master well, the other door of their own learning will be.
But for beginners, without any language foundation to start self-study, then congratulate you, rookie see this article for proof, starting from today, self-study, a year later, if you can make a software, come to me to ask for 1000 dollars. Haha, really.
Basically self-study is a professional to do things, like a musical instrument, their own learning may learn another door, but I did not have the basis of music, followed by the teacher did not learn the guitar.
So the advice does not have the basis and want to learn Python students, spend some money to report a class to learn it, take money for time, time is life, money has no more money, time passed will never come back, if you do not superstitious, do not have to learn, then I admire your courage, but you have to try to know.
Of course there is no absolute thing, my big celestial ox x people more go, many people can also self-taught programming, finally become a master, my python is self-taught, but I can say that the process of self-study through the N-pit good, many times tangled in a simple small problem on a few days are stuck, At that time if not because of job requirements, estimated to give up early, this is Python, do not say other complex language, I believe that in addition to a small number of Daniel, most people are not smarter than I go to, choose self-taught with shoes, all the way to treasure.
Said so much, just want to tell those who are confused to learn what language of the novice, in you have not learned to walk, do not always think, in the future I become the boss, I am driving a BMW? Or drive a Mercedes? Learn to ride a bike first! (Received from: http://www.yuminstall.com/or-need-to-learn-python.html)
Installation of 1.2 python
Install under Linux:
(1) View Linux under Python version:
[Email protected]_46_188_centos ~]# python-v
Python 2.7.5
(2) Enter the python command prompt:
[Email protected]_46_188_centos ~]# python
Python 2.7.5 (default, 4 2017, 00:39:18)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>> print ' Hello World '
Hello World
>>> exit ()
Exit Python exit () or Ctrl+d
(3) Install Ipython (make Python auto-completion)
1. Installation command: (PIP official website Http://pypi.python.org/pypi/ipython)
Yum Install epel-release
Yum Install Python-pip
pip Install Ipython
2. View Ipython version:
[Email protected]_46_188_centos ~]# pip list
Chardet (2.2.1)
Configobj (4.7.2)
Decorator (3.4.0)
Iniparse (0.4)
IPy (0.75)
Ipython (1.2.1)
Jsonschema (2.5.1)
Kitchen (1.1.1)
3. Enter the Ipython command designator:
[Email protected]_46_188_centos env]# Ipython
Python 2.7.5 (default, 4 2017, 00:39:18)
Type "Copyright", "credits" or "license" for more information.
IPython 3.2.1--an enhanced Interactive Python.
? Introduction and overview of IPython ' s features.
%quickref, Quick Reference.
Help, Python ' s own Help system.
Object? Details about ' object ', use ' object? ' for extra details.
In [1]: print ' Hello World '
Hello World
In [2]:
Install under Windows:
(1) Download the Windows installation package on the official website:
(2) Follow the prompts step by step installation:
(3) Select the installation directory:
(4) Check the directory structure after installation if:
(5) Configure the environment variable path:
Advanced system Settings-----advanced-------Environment variables
(6) System variable in path add "; C:\Python27 ":
(7) Enter Python at the cmd command prompt to enter Python to print Hello World:
Why learn about Python and Python installation