我在requirements.txt里面有化粪池。因此,在readthedocs上构建失败:
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:
autodoc_mock_imports = ['pyscard']在setup.py中:
if os.getenv('READTHEDOCS'):
requirements = [x for x in requirements if "pyscard" not in x]但我还是会犯同样的错误。你遇到过类似的事情吗?如果是的话,你是如何解决这个问题的?
发布于 2022-07-01 09:21:29
我在.readthedocs.yml中添加了:
build:
apt_packages:
- swig
- pcscd
- libpcsclite-dev发布于 2022-06-30 19:12:10
这个头文件是由pcsc提供的.安装libpcsclite-dev (或类似的)包。
https://github.com/LudovicRousseau/pyscard/issues/78
编辑:请跟随Manuel Kaufmann's answer获得详细的解决方案
发布于 2022-06-30 20:03:33
如果不需要pyscard 来构建文档,则应该将其从文档requirements.txt中删除。这是最常见的情况。
您可能需要拆分当前的requirements.txt
requirements.txt与所有只有依赖关系的dependenciesdocs/requirements.txt一起构建文档(没有pyscard))
然后,在您的readthedocs.yaml文件(请参阅https://docs.readthedocs.io/en/stable/config-file/v2.html)中,可以使用:
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中查看常见问题。
https://stackoverflow.com/questions/72820892
复制相似问题