首页 > 解决方案 > 正确构建python PIP包

问题描述

如何将我的应用程序正确构建到 PIP?我已经完成了文档中需要的所有操作并且它可以工作,但是在我进行更新并且我的脚本从一个更改为几个之后(从导入其他脚本的“ main .py”脚本开始)。

我的构建过程现在被打破了。我怎么能解决这个问题?

安装程序.py

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
     name='tests',  
     version='0.0.2',
     scripts=['tests'] ,
     author="Test",
     author_email="test@test.com",
     description="TEST",
     long_description=long_description,
   long_description_content_type="text/markdown",
     url="https://test.com",
     packages=setuptools.find_packages(),
     classifiers=[
         "Programming Language :: Python :: 3",
         "License :: OSI Approved :: MIT License",
         "Operating System :: Unix"
    ],
 )

其中“platops”是一个包含脚本的目录。

错误

错误:[Errno 21] 是一个目录:'tests'

如何正确构建这个?

标签: pythonpython-3.xpip

解决方案


好像你不能在scripts=[]. 你可以在这里阅读它。您可能需要指定每个的相对路径。

从文档:

Scripts are **files** containing Python source code, intended to be 

started from the command line.

编辑:您也可以尝试使用通配符:

scripts=['scripts/*']

推荐阅读