[英]Setup.py install requires local package
I am looking to install a package my-package
using setuptools
.我正在寻找使用
setuptools
安装 package my-package
。 my-package
has a local dependency, utils
. my-package
具有本地依赖项utils
。 My file structure is as follows:我的文件结构如下:
parent/
my-package/
my-package/
setup.py
utils/
utils/
setup.py
I am looking to install the local dependency using the following:我正在寻找使用以下内容安装本地依赖项:
from setuptools import setup
import os
setup(
name='my-package',
version='1.0',
packages=['my-package'],
install_requires=[
# location to your my-package project directory
"file:\\" + os.path.join(os.path.dirname(os.getcwd()), 'utils#egg=utils-1.0')
]
)
Unfortunately this errors out with the following:不幸的是,出现以下错误:
ERROR: Command errored out with exit status 1:
command: /path/to/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/my-package/setup.py'"'"'; __file__='"'"'/home/my-package/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
cwd: /home/my-package/
Complete output (1 lines):
error in my-package setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Invalid requirement, parse error at "'://home/'"
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I have tried the solutions here with no luck.我在这里尝试了解决方案,但没有运气。 Any help is greatly appreciated.
任何帮助是极大的赞赏。
Something like this could work:像这样的东西可以工作:
.
├── One
│ ├── one
│ │ └── __init__.py
│ └── setup.py
└── Two
├── setup.py
└── two
└── __init__.py
One/setup.py
#!/usr/bin/env python3
import setuptools
import pathlib
TWO_PATH = pathlib.Path(__file__).resolve().parent.parent.joinpath('Two')
setuptools.setup(
name='One',
version='1.2.3',
packages=['one'],
install_requires=['Two'],
dependency_links=[
'file://{}#egg=Two-1.2.3'.format(TWO_PATH),
],
)
Try file:\\
instead of file:/
尝试使用
file:\\
而不是file:/
Like how it was done here: https://stackoverflow.com/a/57445003/2096769就像这里的做法一样: https://stackoverflow.com/a/57445003/2096769
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.