【问题标题】:I published a python package called virtualp successfully. But when I'm installing the package it is throwing error我成功发布了一个名为 virtualp 的 python 包。但是当我安装包时它会抛出错误
【发布时间】:2020-11-10 10:15:31
【问题描述】:

这是错误

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'] 
)

【问题讨论】:

    标签: python package pypi


    【解决方案1】:

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

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

    【讨论】:

    • 如果我将它添加到设置中,它将起作用,一旦看到我包含我的 setup.py 文件的编辑
    猜你喜欢
    • 1970-01-01
    • 2022-12-03
    • 2012-04-25
    • 2017-02-28
    • 1970-01-01
    • 1970-01-01
    • 2021-10-17
    • 2017-08-05
    • 2022-10-13
    相关资源
    最近更新 更多