search
HomeBackend DevelopmentPython Tutorial跟老齐学Python之Python安装

任何高级语言都是需要一个自己的编程环境的,这就好比写字一样,需要有纸和笔,在计算机上写东西,也需要有文字处理软件,比如各种名称的OFFICE。笔和纸以及office软件,就是写东西的硬件或软件,总之,那些文字只能写在那个上边,才能最后成为一篇文章。那么编程也是,要有个什么程序之类的东西,要把程序写到那个上面,才能形成最后类似文章那样的东西。

刚才又有了一个术语——“程序”,什么是程序?本文就不讲了。如果列为观众不是很理解这个词语,请上网google一下。

注:推荐一种非常重要的学习方法
在我这里看文章的零基础朋友,乃至于非零基础的朋友,不要希望在这里学到很多高深的python语言技巧。
“靠,那看你胡扯吗?”
非也。重要的是学会一些方法。比如刚才给大家推荐的“上网google一下”,就是非常好的学习方法。互联网的伟大之处,不仅仅在于打打游戏、看看养眼的照片或者各种视频之类的,当然,在某国很长时间互联网等于娱乐网,我忠心希望从读本文的朋友开始,互联网不仅仅是娱乐网,还是知识网和创造网。扯远了,拉回来。在学习过程中,如果遇到一点点疑问,都不要放过,思考一下、尝试一下之后,不管有没有结果,还都要google一下。
列为看好了,我上面写的很清楚,是google一下,不是让大家去用那个什么度来搜索,那个搜索是专用搜索八卦、假药、以及各种穿的很节俭的女孩子照片的。如果你真的要提高自己的技术视野并且专心研究技术问题,请用google。当然,我知道你在用的时候时候困难的,做为一个要在技术上有点成就的人,一定要学点上网的技术的,你懂得。
什么?你不懂?你的确是我的读者:零基础。那就具体来问我吧,不管是加入QQ群还是微博,都可以。
欲练神功,挥刀自宫。神功是有前提地。

要学python,不用自宫。python不用那么残忍的前提,但是,也需要安装点东西才能用。

所需要安装的东西,都在这个页面里面:www.python.org/downloads/

www.python.org是python的官方网站,如果你的英语足够使用,那么自己在这里阅读,可以获得非常多的收获。
在python的下载页面里面,显示出python目前有两大类,一类是python3.x.x,另外一类是python2.7.x。可以说,python3是未来,它比python2.7有进步。但是,现在,还有很多东西没有完全兼容python3。更何况,如果学了python2.7,对于python3,也只是某些地方的小变化了。

所以,我这里是用python2.7为例子来讲授的。

Linux系统的安装

看官所用的计算机是什么操作系统的?自己先弄懂。如果是Linux某个发行版,就跟我同道了。并且我恭喜你,因为以后会安装更多的一些python库(模块),在这种操作系统下,操作非常简单,当然,如果是iOS,也一样,因为都是UNIX下的蛋。只是widows有点另类了。

不过,没关系,python就是跨平台的。

我以ubutu 12.04为例,所有用这个操作系统的朋友(肯定很少啦),你们肯定会在shell中输入python,如果看到了>>>,并且显示出python的版本信息,恭喜你,因为你的系统已经自带了python的环境。的确,ubuntu内置了python环境。

我非要自己安装一遍不可。那就这么操作吧:

#下载源码,目前最新版本是2.7.8,如果以后换了,可以在下面的命令中换版本号
#源码也可以在网站上下载,具体见前述下载页面
wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz

#解压源码包
tar -zxvf Python-2.7.8.tgz

#编译
cd Python-2.7.8
./configure  --prefix=/usr/local    #指定了目录
make&&make install
以上步骤,是我从网上找来的,供参考。因为我的机器早就安装了,不想折腾。安装好之后,进入shell,输入python,会看到如下:

qw@qw-Latitude-E4300:~$ python
Python 2.7.6 (default, Nov 13 2013, 19:24:16)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
恭喜你,安装成功了。我用的是python2.7.6,或许你的版本号更高。

windows系统的安装

到下载页面里面找到windows安装包,下载之,比如下载了这个文件:python-2.7.8.msi。然后就是不断的“下一步”,即可完成安装。

特别注意,安装完之后,需要检查一下,在环境变量是否有python。

如果还不知道什么是windows环境变量,以及如何设置。不用担心,请google一下,搜索:"windows 环境变量"就能找到如何设置了。
以上搞定,在cmd中,输入python,得到跟上面类似的结果,就说明已经安装好了。

Mac OS X系统的安装

其实根本就不用再写怎么安装了,因为用Mac OS X 的朋友,肯定是高手中的高高手了,至少我一直很敬佩那些用Mac OS X 并坚持没有更换为windows的。麻烦用Mac OS X 的朋友自己网上搜吧,跟前面unbutu差不多。

如果按照以上方法,顺利安装成功,只能说明幸运,无它。如果没有安装成功,这是提高自己的绝佳机会,因为只有遇到问题才能解决问题,才能知道更深刻的道理,不要怕,有google,它能帮助列为看官解决所有问题。当然,加入QQ群或者通过微博,问我也可以。

OK!已经安装好之后,马上就可以开始编程了。最后喊一句在一个编程视频课程广告里面看到的口号,很有启发:“我们程序员,不求通过,但求报错”。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Python vs. C  : Learning Curves and Ease of UsePython vs. C : Learning Curves and Ease of UseApr 19, 2025 am 12:20 AM

Python is easier to learn and use, while C is more powerful but complex. 1. Python syntax is concise and suitable for beginners. Dynamic typing and automatic memory management make it easy to use, but may cause runtime errors. 2.C provides low-level control and advanced features, suitable for high-performance applications, but has a high learning threshold and requires manual memory and type safety management.

Python vs. C  : Memory Management and ControlPython vs. C : Memory Management and ControlApr 19, 2025 am 12:17 AM

Python and C have significant differences in memory management and control. 1. Python uses automatic memory management, based on reference counting and garbage collection, simplifying the work of programmers. 2.C requires manual management of memory, providing more control but increasing complexity and error risk. Which language to choose should be based on project requirements and team technology stack.

Python for Scientific Computing: A Detailed LookPython for Scientific Computing: A Detailed LookApr 19, 2025 am 12:15 AM

Python's applications in scientific computing include data analysis, machine learning, numerical simulation and visualization. 1.Numpy provides efficient multi-dimensional arrays and mathematical functions. 2. SciPy extends Numpy functionality and provides optimization and linear algebra tools. 3. Pandas is used for data processing and analysis. 4.Matplotlib is used to generate various graphs and visual results.

Python and C  : Finding the Right ToolPython and C : Finding the Right ToolApr 19, 2025 am 12:04 AM

Whether to choose Python or C depends on project requirements: 1) Python is suitable for rapid development, data science, and scripting because of its concise syntax and rich libraries; 2) C is suitable for scenarios that require high performance and underlying control, such as system programming and game development, because of its compilation and manual memory management.

Python for Data Science and Machine LearningPython for Data Science and Machine LearningApr 19, 2025 am 12:02 AM

Python is widely used in data science and machine learning, mainly relying on its simplicity and a powerful library ecosystem. 1) Pandas is used for data processing and analysis, 2) Numpy provides efficient numerical calculations, and 3) Scikit-learn is used for machine learning model construction and optimization, these libraries make Python an ideal tool for data science and machine learning.

Learning Python: Is 2 Hours of Daily Study Sufficient?Learning Python: Is 2 Hours of Daily Study Sufficient?Apr 18, 2025 am 12:22 AM

Is it enough to learn Python for two hours a day? It depends on your goals and learning methods. 1) Develop a clear learning plan, 2) Select appropriate learning resources and methods, 3) Practice and review and consolidate hands-on practice and review and consolidate, and you can gradually master the basic knowledge and advanced functions of Python during this period.

Python for Web Development: Key ApplicationsPython for Web Development: Key ApplicationsApr 18, 2025 am 12:20 AM

Key applications of Python in web development include the use of Django and Flask frameworks, API development, data analysis and visualization, machine learning and AI, and performance optimization. 1. Django and Flask framework: Django is suitable for rapid development of complex applications, and Flask is suitable for small or highly customized projects. 2. API development: Use Flask or DjangoRESTFramework to build RESTfulAPI. 3. Data analysis and visualization: Use Python to process data and display it through the web interface. 4. Machine Learning and AI: Python is used to build intelligent web applications. 5. Performance optimization: optimized through asynchronous programming, caching and code

Python vs. C  : Exploring Performance and EfficiencyPython vs. C : Exploring Performance and EfficiencyApr 18, 2025 am 12:20 AM

Python is better than C in development efficiency, but C is higher in execution performance. 1. Python's concise syntax and rich libraries improve development efficiency. 2.C's compilation-type characteristics and hardware control improve execution performance. When making a choice, you need to weigh the development speed and execution efficiency based on project needs.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment