python中使用pycharm2018工具安裝Autopep8
阿新 • • 發佈:2018-11-23
PEP 8,Style Guide for Python Code,是Python官方推出編碼約定,主要是為了保證 Python 編碼的風格一致,提高程式碼的可讀性。
這樣的資料網上很多,但是大多都是老版本的,2018版本之前。
我使用的是最新版,有很多改動:
詳細配置參見:
有兩篇文章寫得比較符合我的版本:
1.確保兩個問題,你的機器已經安裝python2.7和pycharm2018
2.同時要安裝autopep8.exe
在windown的cmd命令列中執行:pip install autopep8即可
下面兩篇文章要搭配起來看,第二篇文章,只看安裝pip install autopep8即可
windows安裝成功如下
C:\Users\weiruoyu>pip install autopep8 Collecting autopep8 Downloading https://files.pythonhosted.org/packages/5b/ba/37d30e4263c51ee5a655 118ac8c331e96a4e45fd4cea876a74b87af9ffc1/autopep8-1.4.3.tar.gz (113kB) 44% |██████████████▍ | 51kB 10kB/s eta 0:00:0 53% |█████████████████▎ | 61kB 12kB/s eta 0:0 62% |████████████████████▏ | 71kB 12kB/s eta 71% |███████████████████████ | 81kB 14kB/s et 80% |█████████████████████████▉ | 92kB 15kB/s 89% |████████████████████████████▊ | 102kB 12 98% |███████████████████████████████▋| 112kB 100% |████████████████████████████████| 122k B 17kB/s Collecting pycodestyle>=2.4.0 (from autopep8) Downloading https://files.pythonhosted.org/packages/e5/c6/ce130213489969aa5861 0042dff1d908c25c731c9575af6935c2dfad03aa/pycodestyle-2.4.0-py2.py3-none-any.whl (62kB) 49% |███████████████▊ | 30kB 17kB/s eta 0:00: 65% |█████████████████████ | 40kB 14kB/s eta 82% |██████████████████████████▎ | 51kB 14kB/ 98% |███████████████████████████████▌| 61kB 100% |████████████████████████████████| 71kB 20kB/s Installing collected packages: pycodestyle, autopep8 Running setup.py install for autopep8 ... done Successfully installed autopep8-1.4.3 pycodestyle-2.4.0 You are using pip version 8.1.1, however version 18.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' comm and. C:\Users\weiruoyu>
Pycharm Autopep8的配置
Pycharm配置autopep8讓Python程式碼更符合pep8規範
詳細的內容可以參見:
PEP 8官方文件 -- Style Guide for Python Code
Python PEP8 編碼規範中文版