Python包需要freeglut作为依赖项

2024-10-02 04:26:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在创建一个Python包,我想使用freeglut。有没有办法让它在我安装软件包时,为我找到一个freeglut软件包,然后安装它?我知道如果我只是从pip安装PyOpenGL,我不能使用freeglut,但是如果我使用来自https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl的包,它可以工作。不过,这只适用于Windows。我还尝试将上面的链接作为依赖项添加,方法是将其上载到github,然后将pyopengl@ git+https://raw.githubusercontent.com/rayzchen/PyUnity/master/PyOpenGL-3.1.5-cp38-cp38-win32.whl作为依赖项添加,但我得到了一个错误TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType。我还尝试在安装程序中使用dependency_links,但没有成功。这是我的setup.py:

from setuptools import setup, find_packages
import os

pyopengl_link = "pyopengl @ git+https://raw.githubusercontent.com/rayzchen/PyUnity/master/PyOpenGL-3.1.5-cp38-cp38-win32.whl"
pyopengl_accelerate_link = "pyopengl-accelerate @ git+https://raw.githubusercontent.com/rayzchen/PyUnity/master/PyOpenGL_accelerate-3.1.5-cp38-cp38-win32.whl"
if os.name == "nt":
    links = [pyopengl_link, pyopengl_accelerate_link]
else:
    links = []

print(links)

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

setup(
    name = "pyunity",
    version = "0.0.1",
    author = "Ray Chen",
    author_email = "tankimarshal2@gmail.com",
    description = "A Python implementation of the Unity Engine",
    long_description = long_description,
    long_description_content_type = "text/markdown",
    url = "https://github/rayzchen/PyUnity",
    packages = find_packages(),
    classifiers = [
        "Programming Language :: Python :: 3.7",
        "License :: OSI Approved :: MIT License",
        "Operating System :: Microsoft :: Windows :: Windows 10",
    ],
    dependency_links = links,
    install_requires = [
        "glfw",
        "pygame",
        *links,
    ],
    python_requires = '>=3.7',
)

这只是为了好玩,所以请不要批评我试图在Python中实现Unity


Tags: httpsgitcomwindowslinkdescriptionlinkslong
1条回答
网友
1楼 · 发布于 2024-10-02 04:26:22

我发现的一种方法是将pyopengl @ https://github.com/rayzchen/pyunity/blob/master/PyOpenGL-3.1.5-cp38-cp38-win32.whl作为解决方案,而不是pyopengl @ git+https://github.com/rayzchen/pyunity/blob/master/PyOpenGL-3.1.5-cp38-cp38-win32.whl。我认为git+将克隆repo,然后构建包

相关问题 更多 >

    热门问题