最近在搞智能卡python测试平台环境,然后需要用到两个包(pyscard跟pycrypto),结果安装不了,试了好多方法,最后终于解决。

错误信息如下:

C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\Scripts>pip3 in
stall pyscard
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Ple
ase upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will dro
p support for Python 3.5 in January 2021. pip 21.0 will remove support for this
functionality.


Installing collected packages: pyscard
    Running setup.py install for pyscard ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\administrator\appdata\local\programs\python\python35-32\
python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\User
s\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-han1gboq\\pyscard\\setup.py'"'"';
 __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-han1gboq\\
pyscard\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=
f.read().replace('"'"'
\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __fi
le__, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\p
ip-record-ie5fkc7c\install-record.txt' --single-version-externally-managed --com
pile --install-headers 'c:\users\administrator\appdata\local\programs\python\pyt
hon35-32\Include\pyscard'
         cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-han1gboq\pyscard\


    Complete output (14 lines):
    running install
    running build
    running build_py
    running build_ext
    building 'smartcard.scard._scard' extension



ERROR: Command errored out with exit status 1: 'c:\users\administrator\appdata\l
ocal\programs\python\python35-32\python.exe' -u -c 'import sys, setuptools, toke
nize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-
han1gboq\\pyscard\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Lo
cal\\Temp\\pip-install-han1gboq\\pyscard\\setup.py'"'"';f=getattr(tokenize, '"'"
'open'"'"', open)(__file__);code=f.read().replace('"'"'
\n'"'"', '"'"'\n'"'"');
f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Us
ers\ADMINI~1\AppData\Local\Temp\pip-record-ie5fkc7c\install-record.txt' --single
-version-externally-managed --compile --install-headers 'c:\users\administrator\
appdata\local\programs\python\python35-32\Include\pyscard' Check the logs for fu
ll command output.

 

Python 3.5.2 安装pyscard和pycrypto包失败,解决方法

原因是缺少环境,从下面的链接下载环境,visualcppbuildtools_full.exe

https://download.csdn.net/download/xjs38829890/13210240

下载后解压,然后根据自己python版本号选择安装对应环境

 

安装好环境后,打开pycharm,默认已经打开智能卡工程,点击菜单File=>Settings=>Project=>python interpreter=>python interpreter选择python3.5=>点击+,添加包=>

输入pyscard,并勾上specify version=>然后点击安装包按钮,等待安装成功,如下图:

同样操作安装pycrypto,然后结束。

 

 

 

 

 

 

 

 

 

 

 

本文地址:https://blog.csdn.net/xjs38829890/article/details/110406452