【问题标题】:Python package require freeglut as dependencyPython 包需要 freeglut 作为依赖
【发布时间】:2020-12-08 18:53:10
【问题描述】:

我正在创建一个 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。

【问题讨论】:

    标签: python pip package freeglut


    【解决方案1】:

    我发现的一种方法是将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,然后构建包。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-28
      • 1970-01-01
      • 2020-03-09
      • 2014-09-12
      • 2012-01-13
      • 2018-07-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多