0
我正嘗試在PyPi上上傳我的第一個軟件包。除了我的函數無法訪問包中的相關文件外,一切似乎都很好。錯誤如下。我在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 = '[email protected]',
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 *
這隻適用於我,但其他人下載我的包怎麼樣? –
應該不是問題 - 'path_to_module'是根據安裝包的位置動態計算的。 – phd
完美!謝謝澄清。 –