gpt4 book ai didi

Python:打包时出错

转载 作者:太空宇宙 更新时间:2023-11-04 12:22:08 24 4
gpt4 key购买 nike

我制作了一个 python 包,我的项目目录如下所示:

MyProject
|-.pypirc
|- manifest.in
|- readme.rst
|- runnable.py # Main File
|- setup.py

问题是我在 runnable.py 中有像 tkinter 这样的库,这在 linux 中使用需求安装时会产生问题。如何根据 linux 进行修改?这是我第一次打包模块。

我的 setup.py 看起来像这样-

from setuptools import setup
from sys import platform

setup(name='randomdownloader',
version='0.1.6',
description='random downloader',
author='Pankaj',
author_email='xyz@gmail.com',
license='MIT',
py_modules=['runnable'],
install_requires=[
'youtube-dl',
'bs4',
'BeautifulSoup4',
'requests',
'tkinter',
])

此外,在安装过程中它没有安装到我的 OSX 中,这是我遇到的错误。

Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-vsthnrl2/urllib/

最佳答案

您可以设置一个函数来运行 sys.platform 以区分系统、捕获输出并提取第一个单词。然后,相应地,您可以为所有基于 Debian 的发行版和 osx 运行 apt-get install python3-tk

xcode-select --install
brew uninstall python
brew install python --use-brewed-tk

你当然应该通过

运行所有这些命令
call({command}), preceeded by `import subprocess` in your python script.

这需要进行一些调整,但它应该能为您指明正确的方向。

关于Python:打包时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45688842/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com