编程语言
首页 > 编程语言> > 通过python setup.py创建.deb包

通过python setup.py创建.deb包

作者:互联网

我想为我的python程序创建.deb包.我创建了setup.py,它运行良好,但是当我想使用setup.py和stdeb创建一个debian软件包时,出现错误.

我用来创建.deb的命令:

第一:

python3.4 setup.py sdist

然后:

python3.4 setup.py --command-packages=stdeb.command bdist_deb

但出现错误

dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied;  aborting
dpkg-buildpackage: warning: (Use -d flag to override.)

Traceback (most recent call last):
File "setup.py", line 19, in <module>
install_requires=['setproctitle', 'psycopg2', 'psutil']
File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.4/dist-packages/stdeb/command/bdist_deb.py", line 48, in run
util.process_command(syscmd,cwd=target_dirs[0])
File "/usr/local/lib/python3.4/dist-packages/stdeb/util.py", line 183, in process_command
check_call(args, cwd=cwd)
File "/usr/local/lib/python3.4/dist-packages/stdeb/util.py", line 46, in check_call
raise CalledProcessError(retcode)
stdeb.util.CalledProcessError: 3

我在setup.py中使用以下选项:

packages=['myapp', 'myapp.models', 'myapp.classes', 'myapp.functions'],
package_data={'': ['myapp.conf']},
data_files=[('/usr/local/bin/', ['myapp/myapp_run.py']),
            ('/usr/local/etc/myapp', ['myapp/myapp.conf'])],
install_requires=['setproctitle', 'psycopg2', 'psutil']

我的项目目录如下:

|  setup.py
|- myapp 
        |  __init__.py
        |- classes
                  | __init.py
                  | ...
        | ...
        | myapp_run.py
        | myapp.conf

解决方法:

首先尝试运行此:
    apt-get install python3-stdeb fakeroot python-all

其次是:

python3.4 setup.py sdist

参考链接:Use stdeb to make Debian packages for a Python package

标签:python-3-4,deb,python
来源: https://codeday.me/bug/20191119/2036540.html