2024-03-29 04:57:16 发布
网友
在过去,我在PyPI上看到Python模块发行版,当您使用pip安装它们时,它会将一个可执行文件安装到路径中,不幸的是,我再也找不到这样的版本了。你知道吗
pip
我想知道这怎么可能。你会在你的setup.py里这样做吗?你能让它在多个平台上工作吗?你知道吗
setup.py
一个链接到一个模块这样做也会很有帮助。你知道吗
我说的不是将python模块安装到python路径,而是将可执行文件安装到系统路径!
看看http://python-packaging.readthedocs.org/en/latest/command-line-scripts.html
The scripts Keyword ArgumentThe first approach is to write your script in a separate file, such as you might write a shell script.:funniest/ funniest/ __init__.py ... setup.py bin/ funniest-joke ... The funniest-joke script just looks like this:#!/usr/bin/env python import funniest print funniest.joke() Then we can declare the script in setup() like this:setup( ... scripts=['bin/funniest-joke'], ... ) When we install the package, setuptools will copy the script to our PATH and make it available for general use.
scripts
The first approach is to write your script in a separate file, such as you might write a shell script.:
funniest/ funniest/ __init__.py ... setup.py bin/ funniest-joke
... The funniest-joke script just looks like this:
#!/usr/bin/env python import funniest print funniest.joke()
Then we can declare the script in setup() like this:
setup()
setup( ... scripts=['bin/funniest-joke'], ... )
When we install the package, setuptools will copy the script to our PATH and make it available for general use.
setuptools
PATH
看看http://python-packaging.readthedocs.org/en/latest/command-line-scripts.html
相关问题 更多 >
编程相关推荐