标题:ImportError: No module named 'distutils.version'?
只看楼主
太素元清
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2020-6-2
结帖率:0
已结贴  问题点数:20 回复次数:1 
ImportError: No module named 'distutils.version'?
1、我使用 mitmdump 进行抓取数据时,报了个错误,一直查找解决分案,报错信息如下
程序代码:
C:\Windows\System32>mitmdump -s E:\Python开发\DataTest\酷狗\KGRequestProvider.py
Loading script: E:\Python开发\DataTest\酷狗\KGRequestProvider.py
Script error: Traceback (most recent call last):
  File "E:\Python开发\DataTest\酷狗\KGRequestProvider.py", line 10, in <module>
    import redis
  File "C:\Users\youziku\AppData\Roaming\Python\Python36\site-packages\redis\__init__.py", line 1, in <module>
    from redis.client import Redis, StrictRedis
  File "C:\Users\youziku\AppData\Roaming\Python\Python36\site-packages\redis\client.py", line 12, in <module>
    from redis.connection import (ConnectionPool, UnixDomainSocketConnection,
  File "C:\Users\youziku\AppData\Roaming\Python\Python36\site-packages\redis\connection.py", line 2, in <module>
    from distutils.version import StrictVersion
ImportError: No module named 'distutils.version'


2、这个是我引用的模块
程序代码:
import sys
sys.path.append('C:\\Users\\youziku\\AppData\\Roaming\\Python\\Python36\\site-packages')
import json
import redis
from distutils.version import StrictVersion


3、Python版本如下
C:\Windows\System32>python -V
Python 3.6.3


4、redis版本如下
程序代码:
C:\Windows\System32>pip show redis
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https:// for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Name: redis
Version: 3.5.2
Summary: Python client for Redis key-value store
Home-page: https:// Andy McCurdy
Author-email: sedrik@ MIT
Location: c:\users\youziku\appdata\roaming\python\python36\site-packages
Requires:
Required-by: scrapy-redis



搜索更多相关主题的帖子: python version Users module import 
2020-06-02 16:48
fall_bernana
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:17
帖 子:240
专家分:2086
注 册:2019-8-16
得分:20 
以下是引用太素元清在2020-6-2 16:48:50的发言:

1、我使用 mitmdump 进行抓取数据时,报了个错误,一直查找解决分案,报错信息如下

C:\Windows\System32>mitmdump -s E:\Python开发\DataTest\酷狗\KGRequestProvider.py
Loading script: E:\Python开发\DataTest\酷狗\KGRequestProvider.py
Script error: Traceback (most recent call last):
  File "E:\Python开发\DataTest\酷狗\KGRequestProvider.py", line 10, in <module>
    import redis
  File "C:\Users\youziku\AppData\Roaming\Python\Python36\site-packages\redis\__init__.py", line 1, in <module>
    from redis.client import Redis, StrictRedis
  File "C:\Users\youziku\AppData\Roaming\Python\Python36\site-packages\redis\client.py", line 12, in <module>
    from redis.connection import (ConnectionPool, UnixDomainSocketConnection,
  File "C:\Users\youziku\AppData\Roaming\Python\Python36\site-packages\redis\connection.py", line 2, in <module>
    from distutils.version import StrictVersion
ImportError: No module named 'distutils.version'


2、这个是我引用的模块

import sys
sys.path.append('C:\\Users\\youziku\\AppData\\Roaming\\Python\\Python36\\site-packages')
import json
import redis
from distutils.version import StrictVersion


3、Python版本如下

C:\Windows\System32>python -V
Python 3.6.3


4、redis版本如下

C:\Windows\System32>pip show redis
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https:// for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Name: redis
Version: 3.5.2
Summary: Python client for Redis key-value store
Home-page: https://
Author: Andy McCurdy
Author-email: sedrik@
License: MIT
Location: c:\users\youziku\appdata\roaming\python\python36\site-packages
Requires:
Required-by: scrapy-redis


ImportError: No module named 'distutils.version'
是from distutils.version import StrictVersion 这个报错了.你查看下这个包是否已经安装
2020-06-03 09:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-501928-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.176792 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved