【发布时间】:2018-02-06 17:59:43
【问题描述】:
在上传之前,我在包目录中使用pip3 install -e . 测试我的 PyPI 包。
这取决于pillow(在代码中导入PIL)。
当我使用已安装的枕头进行测试时,它起作用了。
但是,我卸载了pillow,然后用pip3 install -e .重新安装了我的包,它不起作用:
Obtaining file:///Users/hongbook/dev/identicon
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/hongbook/dev/identicon/setup.py", line 4, in <module>
import Identicon
File "/Users/hongbook/dev/identicon/Identicon/__init__.py", line 2, in <module>
from .Identicon import render
File "/Users/hongbook/dev/identicon/Identicon/Identicon.py", line 5, in <module>
from PIL import Image, ImageDraw
ModuleNotFoundError: No module named 'PIL'
我预计安装时应该安装pillow,因为我在install_requires 中写了setup.py 的值(也在requirements.txt 中):
# setup.py
from setuptools import setup, find_packages
...
setup(
name='Identicon',
version=Identicon.__version__,
...
install_requires=[
'pillow',
],
)
# requirements.txt
pillow
如何使我的项目依赖于pillow 对吗?
【问题讨论】:
标签: python pip setuptools pillow