如何在 windows 上为 pyqt5 应用制作一个包(pypi)?
how to make a package(pypi) for pyqt5 app on windows?
我用 pyqt5 编写了一个应用程序并使用 python setup.py sdist
打包它以使其在 PyPi 上可用应用程序 运行 在 Linux 发行版上很好但是 windows 当我 运行 它时,它确实打开了一个控制台,然后显示了实际的应用程序,有什么办法可以修复它吗?
setup.py
from distutils.core import setup
from setuptools import setup
setup(
name="subtodl",
packages = ['Scripts'],
version="0.0.1",
license='MIT',
description = 'a handy tools to download subtitle ',
author = 'mehdi',
install_requires=[
"pyqt5; platform_system=='Windows'",
"beautifulsoup4",
"lxml",
"PyQt5==5.11.3 ;platform_system=='Linux'",
"requests",
"wget",
],
classifiers=[
"Programming Language :: Python :: 3.6",
],
entry_points={
'console_scripts': [
'subtodl= Scripts.subtodlmain:main',
],
},
)
而不是 'console_scripts'
,使用 'gui_scripts'
。
Two groups of entry points have special significance in packaging: console_scripts and gui_scripts.
[...]
The difference between console_scripts and gui_scripts only affects Windows systems. console_scripts are wrapped in a console executable, so they are attached to a console and can use sys.stdin, sys.stdout and sys.stderr for input and output. gui_scripts are wrapped in a GUI executable, so they can be started without a console, but cannot use standard streams unless application code redirects them. Other platforms do not have the same distinction.
我用 pyqt5 编写了一个应用程序并使用 python setup.py sdist
打包它以使其在 PyPi 上可用应用程序 运行 在 Linux 发行版上很好但是 windows 当我 运行 它时,它确实打开了一个控制台,然后显示了实际的应用程序,有什么办法可以修复它吗?
setup.py
from distutils.core import setup
from setuptools import setup
setup(
name="subtodl",
packages = ['Scripts'],
version="0.0.1",
license='MIT',
description = 'a handy tools to download subtitle ',
author = 'mehdi',
install_requires=[
"pyqt5; platform_system=='Windows'",
"beautifulsoup4",
"lxml",
"PyQt5==5.11.3 ;platform_system=='Linux'",
"requests",
"wget",
],
classifiers=[
"Programming Language :: Python :: 3.6",
],
entry_points={
'console_scripts': [
'subtodl= Scripts.subtodlmain:main',
],
},
)
而不是 'console_scripts'
,使用 'gui_scripts'
。
Two groups of entry points have special significance in packaging: console_scripts and gui_scripts.
[...]
The difference between console_scripts and gui_scripts only affects Windows systems. console_scripts are wrapped in a console executable, so they are attached to a console and can use sys.stdin, sys.stdout and sys.stderr for input and output. gui_scripts are wrapped in a GUI executable, so they can be started without a console, but cannot use standard streams unless application code redirects them. Other platforms do not have the same distinction.