将python 2.6升级到2.7后导入错误

时间:2013-08-01 10:19:30

标签: python tweepy

我遇到了在Linux服务器上安装tweepy的问题,如下所示:

[kapom@neptune tweepy-dir]$ sudo python setup.py install    
Traceback (most recent call last):
      File "setup.py", line 3, in <module>
        from setuptools import setup, find_packages
    ImportError: No module named setuptools

然后我尝试安装一个包setuptools ..但是得到了另一个错误......

[kapom@neptune setuptools-0.9.8]$ sudo python setup.py install --prefix=/opt/setuptools
running install
Checking .pth file support in /opt/setuptools/lib/python2.7/site-packages/
/usr/bin/python -E -c pass
TEST FAILED: /opt/setuptools/lib/python2.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /opt/setuptools/lib/python2.7/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

Please make the appropriate changes for your system and try again.

我不确定我做错了什么。有人请帮助我:(

注意** 在尝试安装tweepy之前,我将python版本从2.6更新为2.7,如下面的命令..

./configure
make
sudo make install
sudo update-alternatives --install /usr/bin/python python2.7 /usr/bin/python2.7 10

提前谢谢。

1 个答案:

答案 0 :(得分:0)

保存脚本并清除安装python 2.7后卸载当前的内容,升级或有多个py 2.x / 3.x安装时出现一些问题