pipx install uv

然后有了uv之后

uv python list
Usage: uv python [OPTIONS] <COMMAND>

Commands:
  list       List the available Python installations
  install    Download and install Python versions
  find       Search for a Python installation
  pin        Pin to a specific Python version
  dir        Show the uv Python installation directory
  uninstall  Uninstall Python versions
uv python install cpython-3.13.1-linux-x86_64-gnu

于是我们装一个出来

uv python list
要在使用UV工具时指定特定的Python版本进行项目初始化,可以在执行`uv init`命令时使用`--python`选项。以下是具体的步骤和示例:

### 使用`uv init`指定Python版本

1. **打开终端**: 确保你在项目的根目录下。
2. **执行命令**: 使用以下命令来初始化项目并指定Python版本:
   ```bash
   uv init --python 3.10
   ```
   这将创建一个新的项目,并将其配置为使用Python 3.10版本。

### 示例

如果你想初始化一个名为`my_project`的项目,并确保它使用Python 3.10,可以这样做:
```bash
uv init my_project --python 3.10
```

### 其他选项

- **查看可用的Python版本**: 在初始化之前,你可以使用以下命令查看已安装和可用的Python版本:
  ```bash
  uv python list
  ```

- **锁定特定版本**: 如果需要在项目中锁定特定的Python版本,可以在项目的元数据中设置`requires-python`字段。例如,创建一个脚本文件并在开头添加如下注释:
  ```python
  # /// script
  # requires-python = "==3.10"
  ```

通过以上步骤,你可以轻松地为你的UV项目指定所需的Python版本。

Citations:
[1] https://dev.to/codemee/shi-yong-uv-guan-li-python-huan-jing-53hg
[2] https://knowledge.zhaoweiguo.com/build/html/lang/pythons/tools/dependencys/uv
[3] https://www.cnblogs.com/rongfengliang/p/18391046
[4] https://blog.csdn.net/deephub/article/details/144801548
[5] https://news.qq.com/rain/a/20241229A0318J00
[6] https://github.com/astral-sh/uv/issues/6780
[7] https://www.cnblogs.com/wang_yb/p/18635441
[8] https://docs.astral.sh/uv/guides/install-python/

接着参考这一片:

 https://blog.lemonhall.me/notesview/show/620 

uv init news_checker --python 3.13.1

安装第一个依赖

uv add smolagents
from openai import OpenAI

client = OpenAI(
    base_url='https://api-inference.modelscope.cn/v1/',
    api_key="xxxxxxxxxxxxxxxxxx", # ModelScope Token
)

def main():
    response = client.chat.completions.create(
    model='Qwen/Qwen2.5-VL-72B-Instruct', # ModelScope Model-Id
    messages=[{
        'role':
            'user',
        'content': [{
            'type': 'text',
            'text': '描述这幅图',
        }, {
            'type': 'image_url',
            'image_url': {
                'url':
                    'https://modelscope.oss-cn-beijing.aliyuncs.com/demo/images/audrey_hepburn.jpg',
            },
        }],
    }],
    stream=True
    )

    for chunk in response:
        print(chunk.choices[0].delta.content, end='', flush=True)
    print("Hello from vl-test!")


if __name__ == "__main__":
    main()

好了,跑的很好