我在 PyPi 上的包找不到相关文件

My package on PyPi cannot find relevant files

我正在尝试在 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 *

您可以尝试使用绝对路径。

# this will be the path that the file is stored in
# which for you should be /Users/my_username/anaconda/lib/python3.6/site-packages/deepcut/
path_to_module = os.path.dirname(__file__) 

# now just join it with the file in the weight folder
weight_path = os.path.join(path_to_module, "weight", "object.pk")
with open(weight_path, 'rb') as handle:
    pass