首页 > 技术文章 > Python安装与准备

ithuangqing 2017-02-22 19:03 原文

今天准备开始学习Python了,第一个问题就是安装Python了。要使用Python,一开始没有下载什么IDE,所有的代码都用文本编辑器,我这里使用的是notepad++。

一共需要这么几样东西

1.Python(上官网上下载https://www.python.org/)

2.notepad++

安装好Python后,打开电脑里的powershell,同时在notepad++里面写这么几行代码

print "Hello World!"
print "Hello Again"
print "I like typing this."
print "This is fun."
print 'Yay! Printing.'
print "I'd much rather you 'not'."
print 'I "said" do not touch this.'

然后暂且保存为ex1.py,Python文件以.py结尾,然后在powershell里面输入Python ex1.py  然后敲回车  如果出现错误 那就是路径问题,在powershell里面输入一下代码

[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")然后重启powershell

注意这里的C:\Python27是你的Python的安装路径,另外要注意的一点就是你的ex1.py文件在哪,powershell里的路径就是哪 我的ex1.py文件在桌面 看图片

推荐阅读