Python 包需要 freeglut 作为依赖项
Python package require freeglut as dependency
我正在创建一个 Python 包,我想使用 freeglut。有没有办法让它在我安装包时为我找到一个 freeglut 包并安装它?我知道如果我只是从 pip 安装 PyOpenGL,我不能使用 freeglut,但是如果我使用来自 https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl 的包,它就可以工作。不过,这仅适用于 Windows。我还尝试将上面的 link 添加为依赖项,方法是将其上传到 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。
我发现的一种方法是将 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,然后构建包。
我正在创建一个 Python 包,我想使用 freeglut。有没有办法让它在我安装包时为我找到一个 freeglut 包并安装它?我知道如果我只是从 pip 安装 PyOpenGL,我不能使用 freeglut,但是如果我使用来自 https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl 的包,它就可以工作。不过,这仅适用于 Windows。我还尝试将上面的 link 添加为依赖项,方法是将其上传到 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。
我发现的一种方法是将 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,然后构建包。