pip -e:下划线替换没有魔术下划线 [英] pip -e: No magic underscore to dash replacement
问题描述
如果您使用带有"pip install -e ..."的git repo进行安装,则在某些地方下划线会变为破折号.
Somewhere underscores get changed to dashes, if you install with a git repo with "pip install -e ...".
有什么办法可以阻止这种情况吗?
Is there any way to stop this?
我想使东西自动化.我希望存储库foo_bar
是~/src/foo_bar
,而不是~/src/foo-bar
.
I want to automate stuff. I want repo foo_bar
to be ~/src/foo_bar
, not ~/src/foo-bar
.
推荐答案
从该响应在Python邮件列表上看起来像是由于整个Python打包系统中的众多命名约定以及它们之间的兼容性所致.
From what I can see from this question and this response on the Python mailing list it looks like this is due to numerous naming conventions throughout the Python packaging system, and the compatibility between them.
Pythons setuptools
运行 safe_name
其中:
Pythons setuptools
runs safe_name
which:
将任意字符串转换为标准分发名称
Convert an arbitrary string to a standard distribution name
任何非字母数字/的运行.字符替换为单个-".
Any runs of non-alphanumeric/. characters are replaced with a single '-'.
即使pip
,easy_install
和PyPi
可能接受下划线,但在安装时将其更改为setuptools标准的单个-".
Even though pip
, easy_install
and PyPi
may accept the underscore, when installing it is changed to a single '-' for setuptools standards.
这篇关于pip -e:下划线替换没有魔术下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!