首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >造船厂建筑车轮(setup.py):状态“错误”完成

造船厂建筑车轮(setup.py):状态“错误”完成
EN

Stack Overflow用户
提问于 2022-06-30 19:07:52
回答 3查看 331关注 0票数 1

我在requirements.txt里面有化粪池。因此,在readthedocs上构建失败:

代码语言:javascript
复制
Running setup.py install for pyscard: finished with status 'error'
  error: subprocess-exited-with-error
  
  × Running setup.py install for pyscard did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      running install
      running build
      running build_py
      running build_ext
      building 'smartcard.scard._scard' extension
      swigging smartcard/scard/scard.i to smartcard/scard/scard_wrap.c
      swig -python -outdir smartcard/scard -DPCSCLITE -o smartcard/scard/scard_wrap.c smartcard/scard/scard.i
      creating build
      creating build/temp.linux-x86_64-3.7
      creating build/temp.linux-x86_64-3.7/smartcard
      creating build/temp.linux-x86_64-3.7/smartcard/scard
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DVER_PRODUCTVERSION=2,0,2,0000 -DVER_PRODUCTVERSION_STR=2.0.2 -DPCSCLITE=1 -Ismartcard/scard/ -I/usr/include/PCSC -I/usr/local/include/PCSC -I/home/docs/.pyenv/versions/3.7.9/include/python3.7m -c smartcard/scard/helpers.c -o build/temp.linux-x86_64-3.7/smartcard/scard/helpers.o
      smartcard/scard/helpers.c:28:10: fatal error: winscard.h: No such file or directory
       #include <winscard.h>
                ^~~~~~~~~~~~
      compilation terminated.
      error: command 'gcc' failed with exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyscard

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

我试图跳过docs/docs. in中的pyscard:

代码语言:javascript
复制
autodoc_mock_imports = ['pyscard']

在setup.py中:

代码语言:javascript
复制
if os.getenv('READTHEDOCS'):
        requirements = [x for x in requirements if "pyscard" not in x]

但我还是会犯同样的错误。你遇到过类似的事情吗?如果是的话,你是如何解决这个问题的?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2022-07-01 09:21:29

我在.readthedocs.yml中添加了:

代码语言:javascript
复制
build:
  apt_packages:
    - swig
    - pcscd
    - libpcsclite-dev
票数 0
EN

Stack Overflow用户

发布于 2022-06-30 19:12:10

这个头文件是由pcsc提供的.安装libpcsclite-dev (或类似的)包。

https://github.com/LudovicRousseau/pyscard/issues/78

编辑:请跟随Manuel Kaufmann's answer获得详细的解决方案

票数 2
EN

Stack Overflow用户

发布于 2022-06-30 20:03:33

如果不需要pyscard 来构建文档,则应该将其从文档requirements.txt中删除。这是最常见的情况。

您可能需要拆分当前的requirements.txt

  • requirements.txt与所有只有依赖关系的dependencies
  • docs/requirements.txt一起构建文档(没有pyscard)

)

然后,在您的readthedocs.yaml文件(请参阅https://docs.readthedocs.io/en/stable/config-file/v2.html)中,可以使用:

代码语言:javascript
复制
python:
  install:
    - requirements: docs/requirements.txt

另一方面,如果需要使用pyscard 来构建文档,则可以从文档https://docs.readthedocs.io/en/stable/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules中查看常见问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72820892

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档