python practical guide <1>pygame installation, and vscode

Table of contents

1. Install pygame

1.1, (if the previous one did not respond)

1.2 If there is a red letter

1. Check whether the network proxy is turned on (do not turn it on)

2. Check whether there is a pip module update required

2. Here, by the way, record the environment deployment of vscode Snake

2.1 First download the Python plug-in in vscode

 2.2win system:

2.3 About the red words during runtime


1. Install pygame

Generally very simple, execute the following command in the command window

python -m pip install --user pygame

or 

python3 -m pip install --user pygame

1.1, (if the previous one did not respond)

If all else fails, you may want to consider repairing the pip module

Click on modify in the python application-modify-uncheck pip

Click Modify in the python application-modify-check pip again

1.2 If there is a red letter

1. Check whether the network proxy is turned on (do not turn it on)

2. Check whether there is a pip module update required

python -m pip install --upgrade pip

update command

 success

If that still doesn’t work, please refer to this guy’s guide

(1 message) Solution to the failure of python to install pygame using pip_ainley Yan's blog-CSDN blog_python configuration pip install pygam failed

Effective in personal testing 

2. Here, by the way, record the environment deployment of vscode Snake

2.1 First download the Python plug-in in vscode

and enable

 2.2win system:

terminal window

PS > python --version
Python 3.11.0
PS > python -m venv venv
PS > venv\Scripts\activate
#输入activate 的路径,mac可能在bin目录下

Configuration successful. 

2.3 About the red words during runtime

Run powershell as administrator and perform the following operations

PS C:\Windows\system32> get-ExecutionPolicy
Restricted
PS C:\Windows\system32> set-ExecutionPolicy RemoteSigned

执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 
xxxxx
中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?
[Y] 是(Y)  [A] 全是(A)  [N] 否(N)  [L] 全否(L)  [S] 暂停(S)  [?] 帮助 (默认值为“N”): Y

Finish!

3,Error pygame' imported but unusedflake8(F401)

pygame' imported but unusedflake8(F401

just add to avoid this error

# flake8: noqa

Guess you like

Origin blog.csdn.net/weixin_60787500/article/details/127857722