导语:
本文主要介绍了关于python poetry如何创建项目的相关知识,包括python 开发web项目,以及pythonproject这些编程知识,希望对大家有参考作用。
1、可以通过命令poetrynew创建项目手脚架。
➜ poetry new example
➜ tree
.
└── example
├── example
│ └── __init__.py
├── pyproject.toml
├── README.rst
└── tests
├── __init__.py
└── test_example.py
3 directories, 5 files
2. 诗歌创建示例工程,生成对应文件夹和pyproject.toml,包括工程信息。
在现有项目中,通过命令poetryinit进行初始化。
➜ example poetry init
This command will guide you through creating your pyproject.toml config.
# 交互bash, 通过该交互bash填写项目信息。
Package name [example]: example
Version [0.1.0]: 0.0.8
Description []: example project
Author [so1n <qaz6803609@163.com>, n to skip]: n
License []:
Compatible Python versions [^3.7]:
Would you like to define your main dependencies interactively? (yes/no) [yes] no
Would you like to define your development dependencies interactively? (yes/no) [yes] no
Generated file
# 填写完项目信息后会生成以下内容, 之后会在刚才的路径创建pyproject.toml文件, 并写入。
[tool.poetry]
name = "example"
version = "0.0.8"
description = "example project"
authors = ["Your Name <you@example.com>"]
[tool.poetry.dependencies]
python = "^3.7"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Do you confirm generation? (yes/no) [yes] yes
本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。
本文为原创文章,版权归知行编程网所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ 如何在python中编写类09/13
- ♥ Python正则表达式如何反向引用分组12/09
- ♥ Python如何打印日历?10/16
- ♥ 零基础学Python:一文看懂数字和字符串02/03
- ♥ python 检查目录是否存在08/27
- ♥ 安装后如何运行python?10/24
内容反馈