PyCharm是JetBrains推出的一款IDE,用PyCharm进行Python开发时,不仅可以补全代码、检测错误和实时修复代码,还带有图形化UI的强大调试器可进行调试、测试和性能分析。
下面就和大家一起下载、安装及使用PyCharm
注:适用于Windows系统用户,macOS、Linux用户有些不同
下载PyCharm
可以通过官网下载:
http://www.jetbrains.com/zh-cn/pycharm/download/#section=windows
官网提供专业版(收费)和社区版(免费),作为Python初学者,我们下载社区版就足够了
安装PyCharm
下载完成后双击打开安装包,点击Next下一步
点击Browse选择安装目录,点击Next下一步
勾选以下几个选项,点击Next下一步
点击Install开始安装
安装成功,勾选立即重启电脑,点击Finish完成
启动PyCharm
首次启动PyCharm会弹出配置窗口,按下图选择即可
勾选同意用户使用协议,点击Continue继续
数据共享,选择Don’t send 即可
选择主题,点击Next下一步
安装插件,不安装的话直接点击Start using PyCharm 开始使用PyCharm
下载python
暂时不管PyCharm,我们需要先下载Python
点击Latest Python x.x.x 最新版本
拉到最下面,点击下载可执行安装包
双击运行安装包,勾选add XX to path,点击 Install Now开始安装
使用PyCharm
新建一个项目
选择项目创建的地址,第一次使用PyCharm需要点三角形选择Python解释器
点击Existing interpreter,点击三个小点
选择System interpreter,此时白框内会自动设置为python的安装地址,如果没有,找一下上面安装python时的安装地址即可
在项目文件右键,New,Python File创建文件
输入文件名创建
在文件中输入代码,空白处右键运行,左下角会出现运行结果
如输入import this
会出现Python之禅
Beautiful is better than ugly.
美丽优于丑陋
Explicit is better than implicit.
直白优于含蓄
Simple is better than complex.
简单优于复杂
Complex is better than complicated.
复杂优于繁琐
Flat is better than nested.
扁平优于嵌套
Sparse is better than dense.
间隔优于紧凑
Readability counts.
可读性很重要
Special cases aren’t special enough to break the rules.
即便假借特例的实用性之名,也不可违背这些规则
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea – let’s do more of those!