我正在尝试在我的ubuntu 15.04上安装flask框架。它给了我这个错误,我无法弄明白。如果有人可以提供帮助那就太好了
错误:
pragati@pragati-ubuntu:~/Python-2.7.11$ sudo pip install flask
[sudo] password for pragati:
Downloading/unpacking flask
Downloading Flask-0.10.1.tar.gz (544kB): 544kB downloaded
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 304, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1230, in prepare_files
req_to_install.run_egg_info()
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 293, in run_egg_info
logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 266, in setup_py
import setuptools
File "/usr/share/python-wheels/setuptools-18.4-py2.py3-none-any.whl/setuptools/__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "/usr/share/python-wheels/setuptools-18.4-py2.py3-none-any.whl/setuptools/extension.py", line 8, in <module>
File "/usr/share/python-wheels/setuptools-18.4-py2.py3-none-any.whl/setuptools/dist.py", line 21, in <module>
AttributeError: 'module' object has no attribute 'packaging'
Storing debug log for failure in /home/pragati/.pip/pip.log
答案 0 :(得分:0)
您需要卸载distribute
库并重新安装:
sudo pip uninstall distribute
然后再试一次。
答案 1 :(得分:0)
这可能与编译文件有关。 尝试删除* .pyc文件并重新运行安装。
我的另一个建议(因为它似乎没有)是你应该使用虚拟环境,这样你就可以避免使用sudo
。
答案 2 :(得分:0)
这是最好的工作方式。在使用python开发项目时,您将保护安装在操作系统上的python。你激活virtualenv后不应该使用sudo,之后你可以检查你使用的是哪个pip或python:
which pip