【工具】python代码编辑器--PyCharm下载安装和介绍

PyCharm是一种Python IDE(集成开发环境),由JetBrains打造。它带有一整套可以帮助用户在使用Python语言开发时提高其效率的工具,比如调试、语法高亮、项目管理、代码跳转、智能提示、自动完成、单元测试、版本控制等。此外,PyCharm还提供了一些高级功能,以用于支持Django框架下的专业Web开发。同时,PyCharm也支持Google App Engine和IronPython。这些功能在先进代码分析程序的支持下,使 PyCharm 成为Python专业开发人员和刚起步人员使用的有力工具。

1. 下载

百度或者谷歌搜索:PyCharm

在这里插入图片描述

点击官网进行下载:

在这里插入图片描述

有专业版和社区版2种版本,我们选择社区版,专业版如果是非学生的话,需要收费,因此我们选择下载社区版

在这里插入图片描述
点击Download,完成下载:

在这里插入图片描述

2. 安装

双击exe进行安装:

在这里插入图片描述
点击Next

在这里插入图片描述
选择安装的路径位置

在这里插入图片描述
默认勾选即可,点击Next

在这里插入图片描述

点击Install

在这里插入图片描述

直到安装完成

在这里插入图片描述

点击Finish

在这里插入图片描述

打开PyCharm,勾选

在这里插入图片描述

随便选择一个,进入Pycharm编辑器

在这里插入图片描述
现在可以正常使用PyCharm编辑器了。

使用pycharm编写python代码:

from sklearn.ensemble import RandomForestRegressor
import pandas as pd
import numpy as np
def function1():  #Calculate the function of the second section
    from sklearn.model_selection import GridSearchCV 
    
    data= pd.read_csv('S1 Input train data.csv') # well data
    AC = data.values[:832, 2:3]
    SP = data.values[:832, 3:4]

    LLD = data.values[:832, 5:6]
    LLS = data.values[:832, 6:7] 

#Training feature data
    X=np.concatenate((AC,SP,LLD,LLS),axis=1)
#Training target data
    S2 = data.values[:832, 1:2]

    X_train=np.concatenate((AC,SP,LLD,LLS),axis=1)
    #Here is the range of parameters of max_depth/n_estimators/max_features/min_samples_splitthat the model needs
    param_grid = {
    
    
        'max_depth':[3,4,5, 6, 7, 8, 9, 10,11,12, 13,14,15],    # Depth : Here is the depth of each decision tree in the forest
        'n_estimators':[11,12,13,14,15,16,17,18,19,20,21,22,23],  # Number of Decision Trees - Random Forest Specific Parameters
        'max_features':[0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9], # The proportion of variables used in each decision tree-random forest-specific parameters ( combination principle )
        'oob_score':['true'],
        'min_samples_leaf':[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
        'min_samples_split':[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]  # Minimum split sample size of leaves
    } 
  
    #RandomForestRegressor ( ) model training
    rfc = RandomForestRegressor()
    #Optimize models with grid search and 5-fold cross-validation to find optimal parameters
    rfc_cv = GridSearchCV(estimator=rfc, param_grid=param_grid, cv=5)
    rfc_cv.fit(X_train, S2)
    #Get the best model
    best_model1 = rfc_cv.best_estimator_
    #Parameters and Kernel Functions of the Best Model for Print Output
    print(rfc_cv.best_params_)
   
    return best_model1    #This is the model to calculate the second return.



if __name__ == '__main__':
    # 915~1158.3m   This is the prediction data to pass in the model
    datasetFilename_1 = 'S2 Input dataset for predict S2.CSV'
    test_x_1 = pd.read_csv(datasetFilename_1, usecols=['AC','SP','LLD','LLS'])
    test_x_1=test_x_1.loc[2:19270,['AC','SP','LLD','LLS']]
    #Call the first function, return the rbf _ svr1 model, and pass in the data you want to predict
    rbf_svr1= function1()  
    dataDict1 = test_x_1.to_dict()
    predictResult1=rbf_svr1.predict(test_x_1) 
    dataDict1['Predicted S2'] = pd.Series(predictResult1,index=list(range(2, 19269))).round(5)
    data1 = pd.DataFrame(dataDict1)
    data1.to_excel(r'Predicted_S2_all_RF.xlsx',sheet_name='Predicted',index=True,index_label="index")

在这里插入图片描述

3. 总结

3.1 pycharm总结

PyCharm的优点包括:

  • 高效的代码编辑器,可以高效地编写Python代码,具有自动完成、代码导航、代码重构等功能。
  • 强大的调试器,可以帮助开发者快速找到代码中的错误,提高调试效率。
  • 丰富的插件和扩展支持,可以扩展其功能,例如,支持许多版本控制工具和Web框架,可以帮助开发者更轻松地进行版本控制和Web开发。

PyCharm的缺点包括:

  • 刚开始打开,索引包较慢。
  • 内存占用太高,可能会导致电脑内存小的用户打开之后内存直接占用70-80%。
  • 免费版本功能较少。

总的来说,PyCharm是一种功能强大的Python IDE,可以帮助开发者和初学者提高代码编写和调试的效率,同时也支持丰富的插件和扩展。但是,它也存在一些缺点,例如内存占用较大和免费版本功能较少等。用户可以根据自己的需求和使用情况来选择是否使用PyCharm。

3.2 对比

除了PyCharm,我还用过VS code,下面做一个对比:

PyCharm和VSCode都是广受欢迎的代码编辑器,它们都有一些独特的功能和优势。

  • 专门为Python开发设计:PyCharm是专门为Python开发而设计的,因此它在Python开发方面具有很高的专业性和便利性。而VSCode虽然也可以用于Python开发,但它并不是其主要功能,因此可能在一些方面没有PyCharm那么强大。
  • 界面和可定制性:VSCode的界面更加现代化,可定制性更高。用户可以自由地调整主题、布局、快捷键等,以满足自己的使用习惯和需求。而PyCharm的界面虽然也较为友好,但其可定制性相对较低。
    加载速度:PyCharm在加载速度方面相对较慢,因为它在启动时会进行广泛的代码分析和符号解析。而VSCode则相对较快,可以立即启动。
  • 插件和扩展支持:VSCode拥有庞大的插件库,可以通过安装插件来扩展其功能。而PyCharm虽然也支持插件,但其插件数量和可用功能可能没有VSCode那么多。
  • 对Markdown的支持:VSCode对Markdown有很好的支持,可以进行Markdown编辑和预览。而PyCharm虽然也支持Markdown,但其功能可能没有VSCode那么强大。
  • 远程开发:VSCode在远程开发方面具有更大的灵活性,可以通过Gitpod等工具进行免费和高级的远程开发。而PyCharm在这方面可能需要额外的费用。

综上所述,PyCharm和VSCode都是优秀的代码编辑器,各有其优点和适用场景。用户可以根据自己的需求和使用习惯选择合适的编辑器。

猜你喜欢

转载自blog.csdn.net/AugustMe/article/details/132396554
今日推荐