简体   繁体   English

如何跨平台安装pipenv软件包,方法取决于平台?

[英]How to cross-platform install a package pipenv, method depending on the platform?

I'm trying to install the Shapely package to a cross-platform project using pipenv. 我正在尝试使用pipenv将Shapely软件包安装到跨平台项目中。 However, on Windows, shapely can't be installed using a simple pipenv install shapely , it throws errors for a missing dependent dll. 但是,在Windows上,无法使用简单的pipenv install shapely ,它会为缺少的依赖dll引发错误。 For this purpose, there is a pre-built wheel available from the famous unofficial package wheels by Christoph Gohlke: 为此,克里斯托弗·高尔克(Christoph Gohlke)着名的非官方包装车轮有一个预制的车轮:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
shapely = {file = "https://download.lfd.uci.edu/pythonlibs/n5jyqt7p/Shapely-1.6.4.post2-cp37-cp37m-win_amd64.whl", sys_platform = "== 'win32'"}

[dev-packages]

[requires]
python_version = "3.7"

This wheel is perfect for Windows, but only for Windows. 该滚轮非常适合Windows,但仅适用于Windows。 So how do I specify in a Pipfile that, only if the platform is linux, it can simply pipenv install shapely as: 因此,我如何在Pipfile中指定当平台为linux 时才可以简单地通过pipenv install shapely如下:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
shapely = "==1.6.4.post2"

[dev-packages]

[requires]
python_version = "3.7"

or is this not possible using pipenv? 还是使用pipenv无法做到这一点? Or do I hack together a Pipfile.Windows file that my unfortunate Windows colleague can rename to Pipfile ? 还是将我不幸的Windows同事可以重命名为PipfilePipfile.Windows文件放在一起?

Many thanks for any pointers. 非常感谢您的指导。

wheel distribution is ok with linux as well, sorry, don't know you linux distro, but you can try this: linux也可以进行wheel分配,对不起,不知道您是Linux发行版,但是您可以尝试以下操作:

[packages]
# for linux
shapely = {file = "https://files.pythonhosted.org/packages/97/36/1af447160f713d72f35dd7e749788367b7a13285c4af2fbd675128aa4e99/Shapely-1.6.4.post2-cp37-cp37m-manylinux1_x86_64.whl", platform_system="Linux"}

# for windows
shapely_win = {file = "https://download.lfd.uci.edu/pythonlibs/n5jyqt7p/Shapely-1.6.4.post2-cp37-cp37m-win_amd64.whl", platform_system="Windows"}

shapely_win name doesn't affect package installation shapely_win名称不会影响软件包的安装

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM