python-installation-tutorial

Python 安装教程

Python是跨平台的,可以运行在Windows、Mac和各种Linux/Unix系统上,也就是说在Windows上写Python程序,放到Linux上也是能够运行的。

很多人会推荐 Anaconda 集成安装包,但实际上原版Python在日常编码使用时候基本够用了,可以直接官网下载

python-installation-tutorial
python-installation-tutorial

看版本,x86-64是64位版本、x86是32位版本,你需要下载跟你电脑系统一致的版本。然后看文件类型:

  1. embeddable zip file:是压缩包版本,即便携版解压可用。
  2. executable installer:是可执行的安装版本,即离线版下载到本地后可以直接安装。
  3. web-based installer:是联网安装版,体积很小但需要保持网络畅通。

建议使用离线安装版(executable installer),这样软件在安装过程中会设置系统变量,否则需要自己添加,对新手来说当然越傻瓜化越好。

python-installation-tutorial
python-installation-tutorial

在安装的时候,特别要注意勾上Add Python 3.8 to PATH,然后点“Install Now”即可完成安装,一路保持默认配置即可。

安装完成后打开命令提示符窗口,敲入python后,会出现两种情况。

Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

出现这种情况就表明Python已经安装成功了,可以看到Python的安装版本等等信息。

Microsoft Windows [Version 10.0.0]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\> python
'python' is not recognized as an internal or external command, operable program or batch file.
C:\> _

出现这种错误是因为Windows会根据一个Path的环境变量设定的路径去查找python.exe,如果没找到,就会报错。

如果在安装时漏掉了勾选Add Python 3.8 to PATH,那就要手动把python.exe所在的路径添加到电脑的系统环境变量的Path中。

另外还要测试一下pip有没有安装好,pip是用来安装第三方库的神器,输入pip回车。

python-installation-tutorial
python-installation-tutorial

这样Python就已经安装好了。

About The Author

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Scroll to Top