安装和使用无法通过 pip 或 tarball 分发获得的 python 库的最佳实践
Best practices for installing and using python libraries that are not available through pip or tarball distributions
安装 Python 库在 VCS 上可用但未作为 pip 可安装包维护的库的最佳做法是什么?
到目前为止,我发现很多解决方案仅建议 , but those all appear to require that the maintainer has packaged for a pip install. There's also the ,但在这种情况下,维护者不提供可安装的 tarball。
在 pypi 上曾多次尝试发布此内容,但它们都已过时或存在此类或其他问题。
相关库用于 E-Paper displays from waveshare. The libraries I'd like to use are buried several directories deep within the git repository. To make things worse, the project is released without a license.txt, but does have a generic license text within each library file。许可文本似乎授予了将库包含到任何类型的项目中的广泛许可(请参阅下面的文本)。
我已经提出了一些解决这个问题的方法,但我希望有更好的方法:
将库复制到项目中
问题:
- 图书馆变得陈旧
- 除了手动复制到项目中外,没有简单的方法来更新它们
重新打包库并上传到pip
问题:
- 我现在需要维护 pypi 项目
- 它们最终变得陈旧,并且出现的问题与我目前发现的完全一样
有一个 setup.py
,所以应该可以使用以下命令安装项目:
pip install -e 'git+https://github.com/waveshare/e-Paper.git#egg=waveshare-epd&subdirectory=RaspberryPi&JetsonNano/python'
但它失败了,因为目录名称中有一个符号 (&
)。如果有可能以某种方式转义该字符,它可能会起作用。
我尝试了一些 url 编码变体等,但无法直接从 pip 获取它...所以我改为执行以下操作:
git clone https://github.com/waveshare/e-Paper
cd e-Paper/RaspberryPi\&JetsonNano/
pip3 install -e .
→
Successfully installed waveshare-epd
:D
安装 Python 库在 VCS 上可用但未作为 pip 可安装包维护的库的最佳做法是什么?
到目前为止,我发现很多解决方案仅建议
在 pypi 上曾多次尝试发布此内容,但它们都已过时或存在此类或其他问题。
相关库用于 E-Paper displays from waveshare. The libraries I'd like to use are buried several directories deep within the git repository. To make things worse, the project is released without a license.txt, but does have a generic license text within each library file。许可文本似乎授予了将库包含到任何类型的项目中的广泛许可(请参阅下面的文本)。
我已经提出了一些解决这个问题的方法,但我希望有更好的方法:
将库复制到项目中
问题:
- 图书馆变得陈旧
- 除了手动复制到项目中外,没有简单的方法来更新它们
重新打包库并上传到pip
问题:
- 我现在需要维护 pypi 项目
- 它们最终变得陈旧,并且出现的问题与我目前发现的完全一样
有一个 setup.py
,所以应该可以使用以下命令安装项目:
pip install -e 'git+https://github.com/waveshare/e-Paper.git#egg=waveshare-epd&subdirectory=RaspberryPi&JetsonNano/python'
但它失败了,因为目录名称中有一个符号 (&
)。如果有可能以某种方式转义该字符,它可能会起作用。
我尝试了一些 url 编码变体等,但无法直接从 pip 获取它...所以我改为执行以下操作:
git clone https://github.com/waveshare/e-Paper
cd e-Paper/RaspberryPi\&JetsonNano/
pip3 install -e .
→
Successfully installed waveshare-epd
:D