Python软件包需要freeglut作为依赖项

问题描述

我正在创建一个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 = "[email protected]",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。

解决方法

我发现的一种方法是将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+将克隆存储库,然后构建程序包。