python3.7入门系列一 Win7下安装python3.7

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/bowei026/article/details/89260507

本文为Python3.7入门系列的第一篇,Win7安装下安装python3.7

一、安装python3.7

访问 https://www.python.org/downloads/windows/,下载python3.7的安装程序

双击下载的python-3.7.3-amd64.exe文件进行安装

勾选“Add Python 3.7 to PATH”(目的是为了将python的安装目录和其下的Scripts目录加入到PATH环境变量中),然后点击“Customize installation”,进入下一步

点击Next

输入安装路径,点击Install按钮,开始安装

安装结束后显示安装成功界面

点击Close退出安装。

二、Hello Python

打开命令行窗口,输入python,然后回车,显示python的版本及最后显示>>>说明python安装成功

执行print函数,输出hello python
>>> print("hello python")
hello python
>>>

以后看到三个向右的箭头(>>>)即说明当前处于python的交互模式下,此时可以输入python函数或者其他语句,如执行 quit()函数可以退出命令行。

可以把 print("hello python") 保存到一个python文件(如 hello.py)中,然后在命令行执行 python hello.py

注意:执行python hello.py 时需要确认hello.py在当前目录下,否则会报错,如下
C:\Users\test>python hello.py
python: can't open file 'hello.py': [Errno 2] No such file or directory

此时加上python文件的完整路径也可以执行,如
C:\Users\test>python d:\hello.py
hello python
 

本文内容到此结束,更多内容可关注公众号和个人微信号:

猜你喜欢

转载自blog.csdn.net/bowei026/article/details/89260507
今日推荐