我成功发布了一个名为virtualp的python软件包。但是当我安装软件包时,它会抛出错误

时间:2020-07-21 04:53:00

标签: python package pypi

这是错误

Defaulting to user installation because normal site-packages is not writeable
Collecting virtualp
Using cached virtualp-0.0.1.tar.gz (2.1 kB)
ERROR: Command errored out with exit status 1:
 command: 'C:\Program Files (x86)\Python36-32\python.exe' -c 'import sys, setuptools, tokenize;           sys.argv[0] = '"'"'C:\\Users\\SANTOS~1\\AppData\\Local\\Temp\\pip-install-kkg3ajy_\\virtualp\\setup.py'"'"'; __file__='"'"'C:\\Users\\SANTOS~1\\AppData\\Local\\Temp\\pip-install-kkg3ajy_\\virtualp\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\SANTOS~1\AppData\Local\Temp\pip-pip-egg-info-_kzh3r8q'
     cwd: C:\Users\SANTOS~1\AppData\Local\Temp\pip-install-kkg3ajy_\virtualp\
Complete output (5 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\SANTOS~1\AppData\Local\Temp\pip-install-kkg3ajy_\virtualp\setup.py", line 15, in <module>
    long_description=open('README.txt').read() + '\n\n' + open('CHANGELOG.txt').read(),
FileNotFoundError: [Errno 2] No such file or directory: 'CHANGELOG.txt'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full    command output.

*我使用此命令安装软件包-> python -m pip install virtualp *

这是setup.py文件

从setuptools导入设置,find_packages

classifiers = [
  'Development Status :: 5 - Production/Stable',
  'Intended Audience :: Education',
  'Operating System :: Microsoft :: Windows :: Windows 10',
  'License :: OSI Approved :: MIT License',
  'Programming Language :: Python :: 3'
]

setup(
  name='virtualp',
  version='0.0.1',
  description='you can use for Virtual Paints',
  long_description=open('README.txt').read() + '\n\n' + open('CHANGELOG.txt').read(),
  url='',  
  author='Santosh Burada',
  author_email='santu.burada99@gmail.com',
  license='MIT', 
  classifiers=classifiers,
  keywords='computer-vision', 
  packages=find_packages(),
  package_data={'virtualp': ['CHANGELOG.txt', 'README.txt']},
  install_requires=['opencv-python', 'numpy'] 
)

1 个答案:

答案 0 :(得分:0)

您需要在对package_data中的setup()的呼叫中设置setup.py。没有它,包中将不包含任何非.py文件。您可以找到详细信息here,但它看起来应该像

setup(
    ...
    package_data={'virtualp': ['CHANGELOG.txt', 'README.txt']}
)