zoukankan      html  css  js  c++  java
  • mac使用poetry

    安装

    为了防止依赖冲突不推荐使用pip的方式直接安装,当然你也可以这样做

    curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python3
    

    常用命令

    init

    用于初始化项目,在项目目录下生成pyproject.toml文件,需要注意:执行这个命令时,会要求你输入pyproject.toml配置文件中的常用选项。

    $ poetry init
    

    install

    上面也提到过,主要用来安装配置的依赖包,同时将依赖包信息写到poetry.lock文件中(首次)。

    $ poetry install
    

    update

    上面提到过,主要用于获取最新版本的依赖,同时更新poetry.lock文件

    $ poetry update
    

    add

    主要用于将依赖包添加到pyproject.toml文件中,同时会安装它们。

    $ poetry add requests pendulum
    

    remove

    主要用于删除已经安装的依赖包。

    $ poetry remove pendulum
    

    show

    主要用于列出可用的依赖包,show后面可以加上依赖包的名称,显示更详细的内容。

    $ poetry show (requests)
    

    run

    主要用来执行python命令,会将run之后的命令放到python环境执行。

    $ poetry run python -V
    

    build

    主要用来将python文件打包,打包之后的产物有两种包的格式:sdist是源码格式;wheel是编译之后的格式。

    $ poetry build
    

    publish

    主要用来将用build命令打包完成的产物上传到PyPI上。

    用于配置正确的账号和用户名,这样才可以正常上传

    $ poetry config http-basic.pypi username password
    $ poetry publish
    

    假如你们公司有自己的私有仓库,则可以通过如下方式上传:
    先配置私有仓库的信息,然后再上传

    $ poetry config repositories.foo https://foo.bar/simple/
    $ poetry config http-basic.foo username password
    $ poetry publish -r my-repository
    

    运行Python脚本

    poetry run python app.py
    
  • 相关阅读:
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    《EffectiveJava中文第二版》 高清PDF下载
    《MoreEffectiveC++中文版》 pdf 下载
    《啊哈c语言》 高清 PDF 下载
  • 原文地址:https://www.cnblogs.com/c-x-a/p/11881249.html
Copyright © 2011-2022 走看看