【发布时间】:2017-11-26 12:42:01
【问题描述】:
我正在尝试在 PyPi 上上传我的第一个包。一切似乎都很好,除了我的功能无法访问包中的相关文件。错误如下。
File "/Users/my_username/anaconda/lib/python3.6/site-packages/deepcut/deepcut.py", line 134, in tokenize
with open('weight/object.pk', 'rb') as handle:
FileNotFoundError: [Errno 2] No such file or directory: 'weight/object.pk'
我已经检查了 pip 是否确实使用包安装了我的文件。这是我安装的目录 /Users/my_username/anaconda/lib/python3.6/site-packages/deepcut 中的内容
__init__.py
deepcut.py
__pycache__
...
weight
best_cnn.h5
object.pk
我用来创建包的文件夹包括
LICENCE.txt
MANIFEST
MANIFEST.in
README.rst
setup.dfg
setup.py
deepcut
__init__.py
deepcut.py
weight
best_cnn.h5
object.pk
安装文件内容如下。
from distutils.core import setup
import setuptools
setup(
name = 'deepcut',
packages = ['deepcut'],
package_dir={'deepcut': 'deepcut'},
package_data={'deepcut': ['weight/*']},
include_package_data=True,
version = '0.5.0.13',
install_requires=['keras', 'pandas', 'scipy', 'numpy'],
license='MIT',
description = 'A Thai word tokenization library using Deep Neural Network',
author = 'Rakpong Kittinaradorn',
author_email = 'r.kittinaradorn@gmail.com',
url = 'https://github.com/rkcosmos/deepcut',
download_url = 'https://github.com/rkcosmos/deepcut/package/0.5.zip',
keywords = ['thai word segmentation deep learning neural network development'],
classifiers = ['Development Status :: 3 - Alpha'],
)
和 MANIFEST.in
# Include the license file
include LICENSE.txt
include README.rst
# Include the data files
recursive-include deepcut *
【问题讨论】: