泉缘泉 发表于 2023-9-8 00:57:34

Pycharm的安装和使用

一、下载安装PyCharm

PyCharm官网:https://www.jetbrains.com/pycharm/download/?section=windows
前往PyCharm官网,往下滑动,找到黑色的这个(社区版)点击下载。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907224107247.png
下载完成后双击运行。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907224749338.png
选择安装位置
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907224908527.png
建议将下列选项全部选上
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907225625436.png
点击安装,等待安装完成后重启一下电脑。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907225659860.png
等待安装完成后重启一下电脑。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907225934918.png
二、新建项目

创建一个文件夹用来存放python代码。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907231321302.png
右键单击文件夹,选择用PyCharm打开。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907230516723.png
同意协议,点击continue。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/Snipaste_2023-09-07_23-05-48.png
根据需要选择是否共享数据。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907230824864.png
点击Trust Project,信任项目。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907231121616.png
打开之后,点击右下角的Python解释器。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907231529599.png
点击Add New Interpreter,创建新的解释器。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907231857370.png
将Inherit global site-packages(继承全局站点包)勾选上,点击OK,等待虚拟环境创建完成。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907232044780.png
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907232513515.png
在Python项目文件夹下,右键新建python文件,命名为hello,回车。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907232643747.png
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907232747881.png
将下面这段代码复制粘贴到hello.py中,右键点击运行
if __name__ == '__main__':
    print('hello world!')https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907233613343.png
可以看到下方的终端中显示了输出结果。现在就可以开始你的Python编程之旅了!
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907233727587.png
三、PyCharm的使用技巧

技巧1、使用Ctrl+鼠标滚轮,缩放界面。

打开设置,将Change font size with Ctrl+Mouse Wheel in:勾选上。点击确定,就可以使用Ctrl+鼠标滚轮缩放字体了。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907234131089.png
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907234603585.png
技巧2、设置代码模版

打开设置,找到Python Script,编辑代码模版,点击OK保存。以后新建.py文件时,会自动添加这段代码。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907235428491.png
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230907235702465.png
技巧3、插件

打开设置,找到Plugins,搜索想要安装的插件。
1、翻译插件(Translation)

搜索Translation,选择第一个,点击install安装,在弹出的窗口中,点击Accept接受。等待安装完成后点击Restart IDE,重启PyCharm。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230908000436050.png
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230908000519051.png
插件安装好后,点击右下角的谷歌按钮,将翻译引擎切换为微软翻译。(谷歌翻译国内用不了)
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230908001241843.png
选中一段文本之后,按Ctrl+Shift+Y就可以翻译了。当然,你也可以切换为其他翻译引擎,但需要进行一些配置,可以在这个插件的首页找到配置教程。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230908001436322.png
2、汉化插件(Chinese)

搜索Chinese,选择和下图第二个一样的进行安装,安装完成后重启,PyCharm就被汉化了。
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230908001729641.png
https://mytypora666.oss-cn-chengdu.aliyuncs.com/image-20230908001936579.png

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: Pycharm的安装和使用