“导入json”在IDLE中效果很好,但在Windows 7 cmd中失败

时间:2019-03-24 20:56:30

标签: python json windows cmd

简单的python脚本:

import json

在IDLE中效果很好,但在CMD中却给了我输出

C:\Users\TheJ\Desktop>test4.py
qIQNlQSLi
eOEKiVEYj
aZADnMCZq
bZUTkLYNg
uCNDeHSBj
kOIXdKBFh
dXJVlGZVm
gZAGiLQZx
vCJAsACFl
qKWGtIDCj
Traceback (most recent call last):
  File "C:\Users\TheJ\Desktop\test4.py", line 3, in <module>
    import json
  File "C:\Users\TheJ\AppData\Local\Programs\Python\Python37-32\lib\json\__init__.py", line 106, in <module>
from .decoder import JSONDecoder, JSONDecodeError
  File "C:\Users\TheJ\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 5, in <module>
from json import scanner
  File "C:\Users\TheJ\AppData\Local\Programs\Python\Python37-32\lib\json\scanner.py", line 11, in <module>
NUMBER_RE = re.compile(
AttributeError: module 're' has no attribute 'compile'

操作系统为Windows 7 HP SP1 x64, 系统区域设置为ru_RU,代码页为866

sys.version和sys.path的输出:

空闲:

3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)]
['C:\\Users\\TheJ\\Desktop',
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\idlelib', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32\\lib', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages']

CMD:

C:\Users\TheJ\Desktop>test4.py
3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)]
['C:\\Users\\TheJ\\Desktop', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32\\lib', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32', 
'C:\\Users\\TheJ\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages']

不知道这是32/64位问题还是Unicode / Windows1251或某些路径问题。

谢谢!

0 个答案:

没有答案