Home > Article > Backend Development > What are the tips for using Pycharm, the Python integrated development environment?
PyCharm is a powerful tool for writing complex functional codes that need to be structured. Here is an introduction to how to install PyCharm under Windows.
Operating system: Windows10
PyCharm version: community-2019.2.4
##For the local download address, see the end. Pycharm and Jupyter, the two best IDEs for Python development. 2. Installation steps: 1. Double-click the executable file pycharm-community-2019.2.4.exe, modify the installation path, and then click "Next"2. Check the Installation Option as shown in the figure, and then click "Next"
##3. Click "Install" and wait for installation
4. After the installation is completed, you will be prompted whether to restart the operating system immediately. To ensure functional integrity, select restart immediately.
After restarting, open the software. In addition to selecting the page style, other plug-ins do not need to be selected. Just go to next. A beautiful green interface appearsInstall the professional version, Simplified Chinese is permanently free to use
1. After downloading, open the compressed package and see the crack patch, installation program, and Chinese components arranged from top to bottom
2. Click Install, the installation interface will pop up, click next, and the selection of the installation path will appear. Remember this path, which is required for the localization process.
Then keep clicking next until pycharm is installed, and check the run box on the last page.
Go here and choose to run pycharm. After starting, choose free use and click the blue button to enter the use. Interface
#3. Create or open the project according to the prompts and enter the main interface. At this time, drag the crack patch mentioned at the beginning of the article directly into the pycharm usage interface. A prompt will pop up, click Restart
4. After restarting, you can see that the patch has taken effect. Follow the default selection. To activate, click the blue Install PyCharm button, and then wait until PyCharm restarts
5. After entering the main interface, click Click the help on the toolbar and click the about button in the drop-down bar to view the registration information
6. Congratulations, you can use it for free, and the period of use is until 2089. Let’s start your magical journey below, and use python to reach the top of your life
Conclusion: If you need Chineseization, copy the resources_zh_CN_PyCharm_2020_r1.jar Chineseization package to the lib file of the software installation path to Chineseize the software. Just restart.
Note: pychram2021 already comes with its own Chinese version.Open the menu bar File, select Settings, then select Pulgins, click Marketplace, search for chinese, and then click install to install. Just restart.3. Create a test program
2. Select the path where the project is stored (this path must be empty, otherwise it cannot be created) to create a new project virtual environment by default, then click "Create" and wait for the environment to be configured.
Python code requires a running environment to run. It is not recommended to use the system interpreter global interpreter directly in Pycharm. The third-party packages to be used are also managed here.
When creating a Python project, pycharm can choose the virtual environment you need to use. This time we introduce the use of the default Virtualenv.
The virtual running environment can separate projects. Each project can have an independent running environment. Of course, you can let multiple projects share a virtual environment.
Fill in the project path and project name in Location;
The second Location is the path of the virtual environment
Select the global Python interpreter in the Base interpreter drop-down box;
Check Inherit global site-packages: you can use third-party libraries in the base interpreter (that is, use cmd command to install the third-party library globally), if not selected, it will be completely isolated from the outside world;
Check Make available to all projects: This virtual environment can be provided to other projects.
Virtualenv creates a venv folder in the root directory of the project by default to store the contents of the virtual environment.
#3. After the configuration is completed, just "Close" the pop-up prompt box. Of course, it’s okay if you’re interested and want to take a look. Overall structure of the interface
#After entering the main interface, right-click the path created above and click "New" - "Python File"
4. Enter a file name and press Enter. The system will automatically generate and open a tab with the .py suffix
5. Enter at the cursor print('Hello World!'), then right-click the tab and select Run, or use the shortcut key Ctrl shift F10
6. The running results will automatically pop up in the area below the software. If the following results appear, congratulations, you succeeded!
Note: Please close PyCharm before Chinese language, and as a noble developer, try not to use
1. Obtain the Chinese package: see the end of the article
2. Place the Chinese package "resources_cn.jar" under lib in the installation directory
3. Restart PyCharm
##5. Usage Tips1. How to change the Python interpreter: In File->Settings->Project: Find Project Interpreter under xxx. Then modify it to the Python interpreter you need. Note: What you must pay attention to here is: when selecting the Python interpreter, you must select the python.exe file, not the python installation folder. 2. How to adjust the editor font and its size 3. How to adjust the console font and its size Size 4. How to set the file encoding 5. How to modify the file background color 6. How to replace 4 space keys with one tab key 7. How to customize the Python template file#!usr/bin/env python # -*- coding: utf-8 -*-# #------------------------------------------------------------------------------- # FileName: ${NAME}.py # Description: # Author: ${USER} # Date: ${DATE} #------------------------------------------------------------------------------- import sys from PyQt4.QtGui import * from PyQt4.QtCore import *Since PyQt is commonly used for software interface development, the following three lines of commonly used code have been added. In addition, commonly used template variables are as follows:
${NAME} - the file name specified in the dialog box for creating the file;
${USER} - the current user name;
${DATE} - the current system date;
${TIME} - the current system time;
${YEAR} - year;
9. Install plug-ins
10. Copy the file path
11. Open
12. View a statement or quote
13. View project structure
14. DEBUG
15. Common shortcut keys
Select the Manage Repositories option in the lower left corner
At this time, you can find that pip in Python is the official source. When using pip to install in China, it is very slow, so it is recommended to change it to the source address in China.
The specific method is to click on the default official source, select uninstall, and then add the domestic source address. The specific steps are as shown in the figure below:
Currently domestic pip Mirror sources include:
Tsinghua: https://pypi.tuna.tsinghua.edu.cn/simpleDouban: http://pypi.douban.com/simple/
Ali: http:// mirrors.aliyun.com/pypi/simple/
Then add the domestic source address in the pop-up window below.
At this point the source address has been updated, click OK.
Note: After the replacement, be sure to click the refresh button. The refreshed interface is as shown below:Select an installation package to download, and you will find Waiting times are significantly reduced.
At this point, if the above method still does not solve the problem, create a new file pip.ini in the %HOMEPATH%\pip\ directory of the Windows system and add the following content to the file.
[global] timeout = 6000 index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = https://pypi.tuna.tsinghua.edu.cn
注意:通过PyCharm下载的包位于项目的虚拟环境中。
The above is the detailed content of What are the tips for using Pycharm, the Python integrated development environment?. For more information, please follow other related articles on the PHP Chinese website!