0

我在 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

先感谢您。

4

1 回答 1

0

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

于 2013-08-01T10:51:08.970 回答