[英]setuptools very simple (one source file module) configuration
I want to use setuptools
to create a package consisting of two files: foo.py
(script) and foo.conf
. 我想用
setuptools
创建一个包包括以下两个文件: foo.py
(脚本)和foo.conf
。
Then I want to publish the package on my devpi-server
and then install the package using pip
. 然后,我想在我的
devpi-server
上发布该软件包,然后使用pip
安装该软件包。
Suppose I that initially I have my current working directory clean 假设我最初的工作目录是干净的
$ ls -l
total 0
Then I issue pip install
(or download
?) command 然后我发出
pip install
(或download
?)命令
$ pip install -i http://mydevpi.server foo
And get a dir with my two files created 并获得创建了我的两个文件的目录
$ tree
.
|
foo
|
|\_ foo.py
|
\_ foo.conf
So questions are: 所以问题是:
setuptools
configuration should I use? setuptools
配置? pip
command should I use to install the package the way I want? pip
命令以所需方式安装软件包? Will pip install -i http://mydevpi.server --target=.
pip install -i http://mydevpi.server --target=.
do the trick? First write somethings as setup.py
in foo directory like: 首先在foo目录中将内容写为
setup.py
,例如:
import setuptools
setuptools.setup(
name='foo_pip',
version='1',
packages=[''],
url='1',
license='1',
author='1',
author_email='1',
description='1'
)
(You can use distutils
or setuptools
) (您可以使用
distutils
或setuptools
)
Then python setup.py bdist_wheel -d TARGET
and there will be a whl
file in target
directory, copy the path. 然后
python setup.py bdist_wheel -d TARGET
, target
目录中将有一个whl
文件,复制路径。
You can now install using pip install the_wheel_file_path --prefix="the_path_to_install"
您现在可以使用
pip install the_wheel_file_path --prefix="the_path_to_install"
Something like this 像这样
Processing .../TARGET/foo_pip-1-py2-none-any.whl
Installing collected packages: foo-pip
Successfully installed foo-pip-1
Then use it by import foo
然后通过
import foo
使用它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.