You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
## 一、项目相关
|
|
|
|
|
|
|
|
|
|
+ 创建或初始化项目
|
|
|
|
|
```shell
|
|
|
|
|
mkdir projectName
|
|
|
|
|
cd projectName && uv init --python 指定版本
|
|
|
|
|
```
|
|
|
|
|
目录结构如下
|
|
|
|
|
```text
|
|
|
|
|
.
|
|
|
|
|
├── .venv
|
|
|
|
|
│ ├── bin
|
|
|
|
|
│ ├── lib
|
|
|
|
|
│ └── pyvenv.cfg
|
|
|
|
|
├── .python-version
|
|
|
|
|
├── README.md
|
|
|
|
|
├── hello.py
|
|
|
|
|
├── pyproject.toml
|
|
|
|
|
└── uv.lock
|
|
|
|
|
```
|
|
|
|
|
+ 初始化虚拟环境,自动创建.venv文件夹
|
|
|
|
|
```shell
|
|
|
|
|
uv run main.py
|
|
|
|
|
```
|
|
|
|
|
+ 修改python包源,编辑`pyproject.toml`文件,增加如下内容
|
|
|
|
|
```text
|
|
|
|
|
[[tool.uv.index]]
|
|
|
|
|
name = "private-pypi"
|
|
|
|
|
url = "https://mirrors.aliyun.com/pypi/simple/"
|
|
|
|
|
default = true
|
|
|
|
|
```
|