Common settings of PyCharm

        PyCharm is often used when using Python language for web development. PyCharm is a Python IDE created by JetBrains, and the refactoring plug-in Resharper of VS2010 comes from JetBrains. At the same time it supports Google App Engine, and PyCharm supports IronPython. These features, supported by advanced code analysis programs, make PyCharm a powerful tool for Python professional developers and starters.
       1. Go to the official website of PyCharm to download the tool
       . 2. Download the Python parser: Python 2.7.8, and configure the Python path environment variable.
  2.1) There are many versions of Python , the most commonly used is Python2.7.x, and the latest version in July 2020 is Python 3.8.3.
  Python2.7.8 download address:
  https://www.python.org/downloads/release/python-278/
  If you want to download other versions of Python, please change the suffix /python-xxxx/ of the website to the corresponding version number, such as /python-273/, /python-2711/, /python-383/, as follows:  
  https://www.python.org/downloads/release /python-273/
   https://www.python.org/downloads/ release /python-2711/
  https://www.python.org/downloads/release /python-383/
  
  2.2) Configure the Python environment variable path
  path to the installation path of Python on your computer. For example, if your Python2.7.x is installed on G drive, Then path = G:\Python27; The
  specific configuration is as follows:
  Right-click [My Computer]-"Properties-"Advanced Environment Settings-"Environment Variables -" Find the path in [System Variables], the configuration is as follows:

path = G:\Python27;

        As shown in Figure 1:

Figure (1) Configure environment variable path
  2.3) Test whether Python2.7.x is successfully installed and click "Start" in the lower left corner of the desktop --- "cmd ---" and enter the command:
python -V

        as shown in picture 2:

Figure (2) Input command: python -V, check the version of python, the output can be correct, indicating that the installation is successful.

3. Open PyCharm and set the style and font size of the software.
  Style: Windows, Font: Consolas, Font
  Size: 16 Click [File] —> Settings —> Appearance —> Theme: Windows, Name: Consolas ,Size: 16 on the toolbar, as shown in Figure (3):

Figure (3) Set the style of PyCharm
  Then, click Setting /Editor ---> Colors & Fonts --->Fonts, create a font style Darcula_test2 --->OK, set Primary font: Courier New, font size: 16, as shown in (4), (5) Shown:
Figure (4) Click [Save as] to create a font style: Darcula_test2
Figure (5) Set the font in the source code: Courier New, size: 16
  To test the running effect of Python, enter the code:  
//Python2 version code
#-*- coding: UTF-8 -*-
import sys
type = sys.getfilesystemencoding()

mystr = "my string"
print(mystr)

print "Hello world"
a = "I am"
b = " a student"
##连接两个字符串a和b
c = a+b

biao = '--两个字符串相连: a+b = '
##将utf-8转换为本地字符串
print biao.decode('utf-8').encode(type)

print c

//Python3 version code

#-*- coding: UTF-8 -*-
import sys
type = sys.getfilesystemencoding()

mystr = "my string"
print(mystr)

print("Hello world")
a = "I am"
b = " a student"
##连接两个字符串a和b
c = a+b

biao = '--两个字符串相连: a+b = '
##将utf-8转换为本地字符串
print(biao.encode(type).decode('utf-8'))

print(c)

        Click run on the toolbar, the effect is as follows:

Figure (6) The effect of running Python code in PyCharm

Guess you like

Origin blog.csdn.net/sanqima/article/details/107299826