zoukankan      html  css  js  c++  java
  • pycharm 常用设置

    pycharm常用设置

    lz提示一下,pycharm中的设置是可以导入和导出的,file>export settings可以保存当前pycharm中的设置为jar文件,重装时可以直接import settings>jar文件,就不用重复配置了。

    file -> Setting ->Editor

    1. 设置Python自动引入包,要先在 >general > autoimport -> python :show popup

         快捷键:Alt + Enter: 自动添加包

    2. “代码自动完成”时间延时设置

      > Code Completion   -> Auto code completion in (ms):0  -> Autopopup in (ms):500

    3. Pycharm中默认是不能用Ctrl+滚轮改变字体大小的,可以在〉Mouse中设置

    4. 显示“行号”与“空白字符”

      > Appearance  -> 勾选“Show line numbers”、“Show whitespaces”、“Show method separators”

    5. 设置编辑器“颜色与字体”主题

      > Colors & Fonts -> Scheme name -> 选择"monokai"“Darcula”

      说明:先选择“monokai”,再“Save As”为"monokai-pipi",因为默认的主题是“只读的”,一些字体大小颜色什么的都不能修改,拷贝一份后方可修改!

      修改字体大小

    > Colors & Fonts -> Font -> Size -> 设置为“14”

    6. 设置缩进符为制表符“Tab”

      File -> Default Settings -> Code Style

      -> General -> 勾选“Use tab character”

      -> Python -> 勾选“Use tab character”

      -> 其他的语言代码同理设置

    7. 去掉默认折叠

      > Code Folding -> Collapse by default -> 全部去掉勾选 

    8. pycharm默认是自动保存的,习惯自己按ctrl + s  的可以进行如下设置:
        > General -> Synchronization -> Save files on frame deactivation  和 Save files automatically if application is idle for .. sec 的勾去掉

        > Editor Tabs -> Mark modified tabs with asterisk 打上勾

    9.>file and code template>python scripts

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    """
    __title__ = '$Package_name'
    __author__ = '$USER'
    __mtime__ = '$DATE'
    # code is far away from bugs with the god animal protecting
        I love animals. They taste delicious.
                  ┏┓      ┏┓
                ┏┛┻━━━┛┻┓
                ┃      ☃      ┃
                ┃  ┳┛  ┗┳  ┃
                ┃      ┻      ┃
                ┗━┓      ┏━┛
                    ┃      ┗━━━┓
                    ┃  神兽保佑    ┣┓
                    ┃ 永无BUG!   ┏┛
                    ┗┓┓┏━┳┓┏┛
                      ┃┫┫  ┃┫┫
                      ┗┻┛  ┗┻┛
    """

    10 python文件默认编码

    File Encodings> IDE Encoding: UTF-8;Project Encoding: UTF-8;

    11. 代码自动整理设置

    这里line breaks去掉√,否则bar, 和baz会分开在不同行,不好看。

    皮皮Blog

    File -> Settings -> appearance

    1. 修改IDE快捷键方案

      > Keymap

    1) execute selection in console : add keymap > ctrl + enter

      系统自带了好几种快捷键方案,下拉框中有如“defaul”,“Visual Studio”,在查找Bug时非常有用,“NetBeans 6.5”,“Default for GNOME”等等可选项,

      因为“Eclipse”方案比较大众,个人用的也比较多,最终选择了“Eclipse”。 

      还是有几个常用的快捷键跟Eclipse不一样,为了能修改,还得先对Eclipse方案拷贝一份: 

      (1).代码提示功能,默认是【Ctrl+空格】,现改为跟Eclipse一样,即【Alt+/】

      Main menu -> code -> Completion -> Basic -> 设置为“Alt+/”

      Main menu -> code -> Completion -> SmartType -> 设置为“Alt+Shift+/”

      不过“Alt+/”默认又被 

      Main menu -> code -> Completion -> Basic -> Cyclic Expand Word 占用,先把它删除再说吧(单击右键删除)!

      (2).关闭当前文档,默认是【Ctrl+F4】,现改为跟Eclipse一样,即【Ctrl+W】

      Main menu -> Window -> Active Tool Window -> Close Active Tab -> 设置为 “Ctrl+F4”;

      Main menu -> Window -> Editor -> Close -> 设置为 “Ctrl+W”;

    2.设置IDE皮肤主题

     > Theme -> 选择“Alloy.IDEA Theme”

      或者在setting中搜索theme可以改变主题,所有配色统一改变

    File > settings > build.excution

    每次打开python控制台时自动执行代码

    > console > pyconsole

    import sys
    # print('Python %s on %s' % (sys.version, sys.platform))
    sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])
    import  os
    print('current workdirectory : ', os.getcwd() )
    import  numpy as  np
    import  scipy as sp
    import  matplotlib as mpl

    如果安装了ipython,则在pyconsole中使用更强大的ipython

    > console

    选中use ipython if available

    这样每次打开pyconsole就会打开ipython

    Note: 在virtualenv中安装ipython: (ubuntu_env) pika:/media/pika/files/mine/python_workspace/ubuntu_env$pip install ipython

    File > settings > Languages & Frameworks

    如果在项目设置中开启了django支持,打开python console时会自动变成打开django console,当然如果不想这样就关闭项目对django的支持:

    如果打开支持就会在 settings > build.excution > console下多显示一个django console:

    Django console设置如下

    import sys
    print('Python %s on %s' % (sys.version, sys.platform))
    import django
    print('Django %s' % django.get_version())
    sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])
    if 'setup' in dir(django): django.setup()
    import django_manage_shell; django_manage_shell.run(PROJECT_ROOT)

    File > settings > Project : initial project

    project dependencies > LDA > project depends on these projects > 选择sim_cluster就可以在LDA中调用sim_cluster中的包

    [Configure PyCharm]

  • 相关阅读:
    Binary Search Tree Iterator 解答
    Invert Binary Tree 解答
    Min Stack 解答
    Trapping Raining Water 解答
    Candy 解答
    Jump Game II 解答
    Implement Hash Map Using Primitive Types
    Gas Station 解答
    Bucket Sort
    HashMap 专题
  • 原文地址:https://www.cnblogs.com/smuxiaolei/p/7450048.html
Copyright © 2011-2022 走看看