【问题标题】:(Python's) shebang too long(Python 的)shebang 太长了
【发布时间】:2018-09-20 14:25:26
【问题描述】:

使用 Python 安装脚本时,shebang 将被替换,如 this post 中所述。

问题是在我的情况下它被替换为

#!/ssoft/spack/paien/v2/opt/spack/linux-rhel7-x86_E5v2_IntelIB/gcc-7.3.0/python-3.6.5-5yxsy6j5miw26wxpzrtync5gnhtsv5pt/bin/python3

这对于操作系统来说似乎太长了:

bad interpreter: /ssoft/spack/paien/v2/opt/spack/linux-rhel7-x86_E5v2_IntelIB/g: no such file or directory

我该如何解决这个问题?

(除了覆盖 setuptools 的默认脚本复制例程。)

【问题讨论】:

  • Here 是一个关于大小限制的问题,但我认为它不能回答你的问题。
  • @GiacomoAlzetta 谢谢,这个问题确实是相关的,虽然我认为它没有得到解决。有一些workaround suggested 似乎对我不起作用。还是我错过了什么?
  • 所以...你没有得到整个shebang
  • @WillVousden 写入脚本的 shebang 是整个路径,但是对于操作系统来说太长了无法读取。除此之外,写入的路径非常依赖于加载的环境(使用spack),即不是很健壮。

标签: python setuptools shebang


【解决方案1】:

这是操作系统的限制,因此您别无选择,只能限制 shebang 长度。

安装到路径较短的目录中。或者创建一个路径更短的符号链接并使用 shebang 中的符号链接。

【讨论】:

  • 非常感谢您的回答。但是,我认为这两个建议都没有给出解决方案。 (1)安装由spack决定,这里我没管。 (2) setuptools 不尊重符号链接,即无论如何放置 Python 可执行文件的路径。
  • 最后好像this issue has been around for a while,但是我找不到任何解决方法...
猜你喜欢
  • 2019-07-11
  • 1970-01-01
  • 1970-01-01
  • 2021-06-01
  • 1970-01-01
  • 2014-05-05
  • 2020-06-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多