目前正在尝试设置我的setup.py文件以进行pip安装,或者只是设置python setup.py开发安装,但是当我运行代码时,它错误地说该方法不可迭代,关于我的读取功能。
setup.py
的代码如下from setuptools import setup, find_packages
import os
def read(filename):
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
return f.read()
setup(
name='example',
version='1.0',
description='example',
url='https://github.com/example',
author='Example',
author_email='iam@example.com',
packages=find_packages,
install_requires=read('requirements.txt').splitlines(),
zip_safe=False
)
最后我收到的错误是,
Traceback (most recent call last):
File "setup.py", line 16, in <module>
install_requires=read('requirements.txt').splitlines()
File "C:\Python35\lib\distutils\core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Python35\lib\site-packages\setuptools\dist.py", line 272, in __init__
_Distribution.__init__(self,attrs)
File "C:\Python35\lib\distutils\dist.py", line 281, in __init__
self.finalize_options()
File "C:\Python35\lib\site-packages\setuptools\dist.py", line 327, in finalize_options
ep.load()(self, ep.name, value)
File "C:\Python35\lib\site-packages\setuptools\dist.py", line 161, in check_packages
for pkgname in value:
TypeError: 'method' object is not iterable
答案 0 :(得分:3)
此行缺少您需要的呼叫表:
packages=find_packages,
将其更改为:
packages=find_packages(),