Home  >  Article  >  Backend Development  >  What are the tips for using Pycharm, the Python integrated development environment?

What are the tips for using Pycharm, the Python integrated development environment?

王林
王林forward
2023-05-14 15:16:06928browse

1. Python Integrated Development Environment-Pycharm Introduction

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

What are the tips for using Pycharm, the Python integrated development environment?

##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"

What are the tips for using Pycharm, the Python integrated development environment?

2. Check the Installation Option as shown in the figure, and then click "Next"

What are the tips for using Pycharm, the Python integrated development environment?##3. Click "Install" and wait for installation

What are the tips for using Pycharm, the Python integrated development environment?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 appears


What are the tips for using Pycharm, the Python integrated development environment?Install the professional version, Simplified Chinese is permanently free to use

The community version of pycharm only has python projects and pure python. The professional version of pycharm has templates for Django projects, flask frameworks and other project file types.

What are the tips for using Pycharm, the Python integrated development environment?1. After downloading, open the compressed package and see the crack patch, installation program, and Chinese components arranged from top to bottom

What are the tips for using Pycharm, the Python integrated development environment?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

What are the tips for using Pycharm, the Python integrated development environment?#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

What are the tips for using Pycharm, the Python integrated development environment?

What are the tips for using Pycharm, the Python integrated development environment?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

What are the tips for using Pycharm, the Python integrated development environment?

What are the tips for using Pycharm, the Python integrated development environment?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

What are the tips for using Pycharm, the Python integrated development environment?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

1. After the configuration is completed, select “Creat new project”

What are the tips for using Pycharm, the Python integrated development environment?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.

What are the tips for using Pycharm, the Python integrated development 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

What are the tips for using Pycharm, the Python integrated development environment?

#After entering the main interface, right-click the path created above and click "New" - "Python File"

What are the tips for using Pycharm, the Python integrated development environment?

4. Enter a file name and press Enter. The system will automatically generate and open a tab with the .py suffix

What are the tips for using Pycharm, the Python integrated development environment?

5. Enter at the cursor print('Hello World!'), then right-click the tab and select Run, or use the shortcut key Ctrl shift F10

What are the tips for using Pycharm, the Python integrated development environment?

6. The running results will automatically pop up in the area below the software. If the following results appear, congratulations, you succeeded!

What are the tips for using Pycharm, the Python integrated development environment?

4. Chinese Pycharm

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

What are the tips for using Pycharm, the Python integrated development environment?

3. Restart PyCharm

What are the tips for using Pycharm, the Python integrated development environment?

##5. Usage Tips

1. 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.

What are the tips for using Pycharm, the Python integrated development environment?

2. How to adjust the editor font and its size

What are the tips for using Pycharm, the Python integrated development environment?

3. How to adjust the console font and its size Size

What are the tips for using Pycharm, the Python integrated development environment?

4. How to set the file encoding

What are the tips for using Pycharm, the Python integrated development environment?

5. How to modify the file background color

What are the tips for using Pycharm, the Python integrated development environment?

6. How to replace 4 space keys with one tab key

What are the tips for using Pycharm, the Python integrated development environment?

7. How to customize the Python template file

What are the tips for using Pycharm, the Python integrated development environment?

#!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:

  • ${PROJECT_NAME} - Current Project name;

  • ${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;

  • ##${MONTH} - month;

  • ##${DAY} - day;
  • ${HOUR} - hours;
  • ${MINUTE} - minutes;
  • ${PRODUCT_NAME} - IDE name of created file;
  • ${MONTH_NAME_SHORT} - English month abbreviation, such as: Jan, Feb, etc;
  • ${ MONTH_NAME_FULL} - The full name of the month in English, such as: January, February, etc;
  • 8. Display the line number

Right-click on the place where the line number is displayed and check Show Line number.

What are the tips for using Pycharm, the Python integrated development environment?9. Install plug-ins

Settings->Plugins->Browse repositories, and then enter the plug-in you want to install.

What are the tips for using Pycharm, the Python integrated development environment?10. Copy the file path

Right click->copy path.

What are the tips for using Pycharm, the Python integrated development environment?11. Open

right click->Show In Explorer in the file manager.

12. View a statement or quote

Place the cursor in the middle of the word, and then press ctrl b or press the ctrl key and the left mouse button.

13. View project structure

What are the tips for using Pycharm, the Python integrated development environment?14. DEBUG

What are the tips for using Pycharm, the Python integrated development environment?15. Common shortcut keys

    ctrl c: Copy the selected content; when the content is not selected, copy the current line.
  • ctrl x: Cut the selected content; cut the current line when the content is not selected.
  • ctrl v: Paste
  • ctrl d: Copy the current line to the next line.
  • ctrl y: Delete the current line.
  • shift enter: jump to the next line.
  • ctrl /: Add a comment.
  • tab: Indent.
  • shift tab: Cancel indentation.
  • ctrl f: Find.
  • ctrl shift r: Find in the current project.
  • ctrl Minus sign: Collapse the current code block.
  • ctrl plus sign: Expand the current code block.
  • ctrl shift minus sign: Collapse all code blocks in the current file.
  • ctrl shift plus sign: Expand all code libraries of the current file.
  • ctrl z: Go back to the previous step
  • shift ctrl z: Go back to the next step
  • 6. Solve the problem that PyCharm is slow when downloading Python third-party libraries

Open Pycharm, click File --> Settings, select Project Interproter in the Project ** option on the left, and click " ” option, that is, the Install installation option. The specific steps are as shown below:

What are the tips for using Pycharm, the Python integrated development environment?Select the Manage Repositories option in the lower left corner

What are the tips for using Pycharm, the Python integrated development environment?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:

What are the tips for using Pycharm, the Python integrated development environment?Currently domestic pip Mirror sources include:

Tsinghua: https://pypi.tuna.tsinghua.edu.cn/simple

Douban: http://pypi.douban.com/simple/
Ali: http:// mirrors.aliyun.com/pypi/simple/
Then add the domestic source address in the pop-up window below.

What are the tips for using Pycharm, the Python integrated development environment?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:


What are the tips for using Pycharm, the Python integrated development environment?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

What are the tips for using Pycharm, the Python integrated development environment?

注意:通过PyCharm下载的包位于项目的虚拟环境中。

What are the tips for using Pycharm, the Python integrated development environment?

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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete