本文介绍了ImportError:没有名为distutils的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
试图安装 psutils
导致头疼...
Attempt to install psutils
resulted a big headache...
$ python -V
Python 2.4.2
$ cat /etc/SuSE-release
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 4
$ cd psutil-2.1.1/
$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 17, in ?
from distutils.core import setup, Extension
ImportError: No module named distutils.core
的模块
下一步-我尝试安装 setuptools
以使用 easy_install
:
$ which easy_install
which: no easy_install
$ cd ../setuptools-1.4/
$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 12, in ?
from distutils.util import convert_path
ImportError: No module named distutils.util
尝试从 ez_setup.py
安装 distutils
:
$ python ez_setup.py
Traceback (most recent call last):
File "ez_setup.py", line 278, in ?
main(sys.argv[1:])
File "ez_setup.py", line 210, in main
egg = download_setuptools(version, delay=0)
File "ez_setup.py", line 139, in download_setuptools
from distutils import log
ImportError: No module named distutils
的模块
那么-我该如何安装?
So - how can I install it?
PS不,我没有root权限,无法使用包管理器。
P.S. No, I haven't root on this machine and can't use package manager.
推荐答案
您需要运行此命令(如果错误发生在python3上)==> sudo apt-get install python3-distutils --reinstall
you need to run this (if Error happens on python3) ==> sudo apt-get install python3-distutils --reinstall
运行此命令(如果python2发生错误)==> sudo apt-get install python2-distutils --reinstall
you need to run this (if Error happens on python2) ==> sudo apt-get install python2-distutils --reinstall
这篇关于ImportError:没有名为distutils的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!