No Description

郑毅 45635d0ffd kimi test 1 month ago
.vscode aa9a1c4d33 获取机场三字码 2 months ago
airport_codes fee1207a1b 202407机场三字码和Google位置数据 1 month ago
json b1c07b0aeb json format convert script 8 months ago
keygen 688221f336 init 4 years ago
kimi 45635d0ffd kimi test 1 month ago
pyTorch 688221f336 init 4 years ago
spider 688221f336 init 4 years ago
str 45635d0ffd kimi test 1 month ago
tensorflow 688221f336 init 4 years ago
.gitignore fa4b0f20af init 4 years ago
README.md 8b43ad8aef update readme 10 months ago
__main__.py 45635d0ffd kimi test 1 month ago
json_test.py b1c07b0aeb json format convert script 8 months ago
jwt_test.py 688221f336 init 4 years ago
md5_test.py 688221f336 init 4 years ago
out.json fee1207a1b 202407机场三字码和Google位置数据 1 month ago
random_test.py 688221f336 init 4 years ago
tmp.json 8b43ad8aef update readme 10 months ago
tmp.py 8b43ad8aef update readme 10 months ago

README.md

Python Get Start

下载开发工具 VS Code

此处 下载安装即可

Python环境准备(一次性操作)

下载安装最新版 MiniConda

打开 VS Code,切换到英文输入法

快捷键 Ctrl/Command + Shift + P,在顶部弹出的选框中输入或选中 Extensions: Install Extensions,在左侧的扩展安装区域中搜索安装 Python 扩展,安装完成后重启 VS Code

快捷键 Ctrl + ~ ,打开命令行终端,执行如下命令

参考 此文章 配置 Windows PowerShell 支持 conda 命令

创建 Conda 虚环境

conda create -n=test python=3.11

conda activate test

快捷键 Ctrl/Command + Shift + P,在顶部弹出的选框中输入或选中 Python: Select Interpreter,再选择 test 虚环境

编写程序

用 VS Code 打开 hello-python 目录

hello-python 程序入口在 main.py

运行程序

选中 main.py

点击 VS Code 左侧边栏的“三角形”图标

点击“运行和调试”

首次运行,会弹出一个对话框,选第一行“执行当前文件”

程序即会开始运行,VS Code 底部将弹出终端窗口,会输出程序打印内容或输出程序执行报错

Conda 常用命令(供参考,不是必须执行的)

虚拟环境

列举

当前环境前面有*号

conda env list

创建

conda create -n py39 python=3.9

删除

conda remove -n py39 --all

激活

conda activate py39

或使用别名

condain py39

退出

conda deactivate py39

或使用别名

condaout py39

配置管理

查看配置

conda config --show

查看channels

conda config --get channels

添加channels

添加国内镜像地址方式即如下

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

如果获取包出现无法访问win-64或osx-64的current_repodata.json的错误,可以尝试添加带环境的channels地址,例如 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64

默认的 default 不建议删除,实在不能获取包时,开爬墙工具重试

重置channels源为默认,使用

conda config --remove-key channels

删除channels

conda config --remove channels https://------------------------

包管理

查找package信息

conda search XXXX

列举包

包管理命令都可以指定虚拟环境,未指定则对当前虚拟环境操作

conda list -n py39

安装包

conda install -n py39 XXXX==版本号

conda install --yes --file requirements.txt

更新包

包括更新conda本身,如下

conda update -n py39 conda

删除包

conda remove -n py39 XXXX