将 python 应用程序打包到 deb 中会抑制虚拟环境的使用吗?
Does packaging python apps into deb inhibits usage of virtual environments?
我目前正在尝试寻找一种方法来为我们的生产主机设置一个用 python 编写的应用程序。我目前使用 Debian 包 apt 存储库,所以我倾向于将应用程序打包到 deb 包中。
stdeb 工具允许我这样做,我使用以下 setup.py
:
成功创建了一个 deb 包
import setuptools
ld = "Some long description"
setuptools.setup(
name = "my_fancy_app",
version="0.0.1",
author="Me Myself",
author_email="me@my.self",
description="Some description",
long_description=ld,
packages=setuptools.find_packages(),
entry_points={
'console_scripts': [ 'hlpth = my_fancy_app.__main__:main' ]
},
classifiers=[
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.7'
)
我看到的问题是 Debian 软件包中的路径已经指定为指向系统 site-packages
。在这里
$ dpkg -c deb_dist/python3-my-fancy-app_0.0.1-1_all.deb
-rw-r--r-- root/root 1 2019-11-27 15:22 ./usr/lib/python3/dist-packages/my_fancy_app/__init__.py
-rw-r--r-- root/root 78 2019-11-27 15:23 ./usr/lib/python3/dist-packages/my_fancy_app/__main__.py
//...other entries omitted
据我现在所见,这样的deb
打包非要设置成"core"打包成site-packages
。有没有办法使用 Debian 软件包解决这个问题并允许应用程序能够安装到虚拟环境中?
Python 虚拟环境使用 Python 的打包工具进行管理(主要是 pip
,但也有其他选择)。
通过将某些东西打包到 Debian 包中,您已经将它移动到与 Python 的工具不兼容的格式,当然 Debian 打包工具对它一无所知Python 虚拟环境。
如果您想在虚拟环境中使用您的应用程序,只需将其打包为 Python 包即可。没有理由为这个用例构建一个 .deb
包。
我目前正在尝试寻找一种方法来为我们的生产主机设置一个用 python 编写的应用程序。我目前使用 Debian 包 apt 存储库,所以我倾向于将应用程序打包到 deb 包中。
stdeb 工具允许我这样做,我使用以下 setup.py
:
import setuptools
ld = "Some long description"
setuptools.setup(
name = "my_fancy_app",
version="0.0.1",
author="Me Myself",
author_email="me@my.self",
description="Some description",
long_description=ld,
packages=setuptools.find_packages(),
entry_points={
'console_scripts': [ 'hlpth = my_fancy_app.__main__:main' ]
},
classifiers=[
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.7'
)
我看到的问题是 Debian 软件包中的路径已经指定为指向系统 site-packages
。在这里
$ dpkg -c deb_dist/python3-my-fancy-app_0.0.1-1_all.deb
-rw-r--r-- root/root 1 2019-11-27 15:22 ./usr/lib/python3/dist-packages/my_fancy_app/__init__.py
-rw-r--r-- root/root 78 2019-11-27 15:23 ./usr/lib/python3/dist-packages/my_fancy_app/__main__.py
//...other entries omitted
据我现在所见,这样的deb
打包非要设置成"core"打包成site-packages
。有没有办法使用 Debian 软件包解决这个问题并允许应用程序能够安装到虚拟环境中?
Python 虚拟环境使用 Python 的打包工具进行管理(主要是 pip
,但也有其他选择)。
通过将某些东西打包到 Debian 包中,您已经将它移动到与 Python 的工具不兼容的格式,当然 Debian 打包工具对它一无所知Python 虚拟环境。
如果您想在虚拟环境中使用您的应用程序,只需将其打包为 Python 包即可。没有理由为这个用例构建一个 .deb
包。