我通过以下结构的setup.py在pypi.python.org上创建了包:
from setuptools import setup, find_packages
setup(
name='my_project',
version='1.0.0',
packages=find_packages(),
long_description='My project',
package_data={
"MyProject.libraries": [
"darwin/lib.so",
"linux/lib.so",
"windows/lib.pyd",
],
},
)
我的目录结构是
myproject/
--libraries/
----__init__.py
----darwin/
------lib.so
----linux/
------lib.so
----windows/
------lib.pyd
readme
setup.py
other files
使用pip安装时:
pip install my_project
我收到错误
Failed building wheel for myproject
Running setup.py clean for myproject
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-fsZH4w/myproject/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" clean --all:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/private/tmp/pip-build-fsZH4w/myproject/setup.py'
但是安装包并且工作正常。
我发现了类似的问题 pip installation throws IOerror - no setup.py,但我的setup.py位于根目录包目录中,所以我认为这不是同一个问题。
答案 0 :(得分:1)
看起来它是关于具有以下规则的命名约定
以下是python包的示例结构
uniq_package/
uniq_package/
__init__.py
linux/
lib.so
darwin/
lib.so
windows/
lib.pyd
setup.py