怎么看: 1年读365本书的骇人方法到底出没发生意图?

4.自家耶想读可未懂得打哪开始。

其一题材自己于今年七月份左右之早晚,问了一个看押了不少写,做翻译出版的爱人,他回复自己说,不知底,你干吗想看,想升官自己的正规化能力或者其他能力?想吓了公就算错过读。读某某出版社的书写,那小出版社的写是,你吧足以多看看管理类的题……

外说之且是外的经验之谈,但是听了自家还是无明了自己欠拘留什么书,倒不是外说之来题目,而是自己好来题目。

咦问题?

急于的问题。一上来即使抱在极其强之目的性去看,有底子的人可,意志力强之口足,对团结事后的宏图明确的丁方可,但是本人还不可以。

胡不得以?

返最初的题目,我干什么要读书来的?为中华之崛起?No!因为自身要好是独懒逼,我还设发霉了,我常有未知晓好如果干什么,我要好吗一向坚持不了啊,我就想让自己变这样堕落,别这么前途无望,我才设看的。

世家觉得不行状态有心思读专业类的图书也?说的粗一点,我风流小说都看不下去你还叫自身读专业类的修?怎么可能?

那么如若实在是这种状态,我该怎么处置吧?

事先下充斥个阅读软件,最好页面简洁,没有弹窗广告的,然后至热点榜单里要推荐里,找你欢喜的,封面、书名,只要能够引起起你感兴趣的,出版书籍还是狗血小说都可,选定了不畏强迫自己关系。

假如产生经济基础买实体书更好。

读,使劲读,浑身难让吗使读。

诵读了事后最好之状态的就是是得静下心来了,可以掉打一些娱乐,可以掉聊会闲篇,慢慢的出就念的私欲了,继续查找感兴趣的书写,接着念,直到慢慢的养成习惯。

而状态仍没成形咋整?

那么便还寻找,再压自己,直到养成习惯了。

顿时玩意儿反正没什么捷径,真不思读,刀架你脖子上啊没因此,这事情只能凭借自己。

如若你生还好的被好提高的主意,那便仍好的法门来,我之章程恐怕是极度愚蠢,最无效的方。

道无定点这同游说,因人而异的道极其契合您。

若是自己的惯养成了,但是以有的无可控因素耽误了今天之计划,不可知按时完成怎么收拾?

尽可能的失弥补,不要觉得今天莫扣没事,明天加及。只要敢于这样想,那么去放弃就非多矣。

本人要好之事例:和内买了跑步机,连续四五龙跑,做仰卧起以,做蹲起之类的,半月丢失了六斤。妻子当老师,后来为夜间备选一个逆领导检查的课件到异常晚就是从不举行继续,我耶随之偷懒没做,她告自己说,一两全活动三四上也是可的,然后…

现跑步机上之灰尘差不多有相同斤吧!

不过真的要发出这种不可避免要紧事发生了,又从不足够的岁月错开好任务了怎么收拾?

优先补一点,今天再也没空,拿出五分钟的时间,读一页,告诉自己我的任务没完结,然后第二上总全力补了,拖到第三龙绝逼很惊险。

再有朋友咨询读书软件之,个人推举百度或者网易的阅读器,有闲钱买Kindle更好。个人用之凡网易云阅读,比较文艺,发出护眼模式,可以涂抹,记笔记,分享,还好订阅一些新闻,用着还算是舒畅。

百度的也无可非议,同样可以涂抹,做笔记,还有一个优势就是可接近免费的羁押有些别的平台出售的图书。缺点就是当中闹广告,不是弹窗的,是图形形式出现的。

工具用在顺手就吓,坚持读书才是王道。

书单也无推荐,网上一样抄几万漫漫,推荐了你见面扣押吗?自己寻找好的,真的到了需阅读就的时刻更去豆瓣或者知乎找。

最终分享同句子话,送给觉得那个为难坚持阅读的意中人等和我好。

先认为坚持即是毫不动摇,现在才明白,坚持即是动摇着,退缩在,但是还是持续开拓进取。

图转自网易云阅读

 

1.休安于,却来一万栽艺术给自己服。

实则会找到这么多跟患相怜的情人起初是生开心的,有种植“不是本人一个丁者逼样”的侥幸感。但是仔细想想又看这桩事其实非常吓人的,为什么可怕,因为马上或许是怪大部一模一样瓜分口的生活工作状态。

透过几单对象的仿,隐约觉得她们之状态比较自己再也糟糕。

不知道你是未是也是纪念最多做最好少?三天前考虑可以如虎,三上后行弱如鸡?做事前把利弊分析的不利,做起来的时段同样遇到困难就完全放弃,知道好问题在哪里,但是生一万栽办法让自己躲过?

如您本的状态是这样的话,那尔得试读书,可以将读书来博一拿。为什么将读书赌?因为看较从旅游,比由外的主意的资金而略微博。如果您习以为常读电子书的话,成本还有些,并且没有外风险。

如今匪是免掌握为何让自己再好吗?那便试试着和和谐从只赌博,较个有力。先不考虑读书有什么力量,就去举行,现在就是开,什么还不顾,不计算成果,不计得失,就是逼迫自己就读书的职责。一字一句,咬牙读了公选定的那本书,什么还足以。等你成功这任务而不怕比较前的您更加成功,哪里成功?你于前多看了扳平本书啊,你比之前多坚持就了同码业务呀,这难道不是提高也?

您恐怕说得的立件事情与事业、金钱、成功并未屁关系啊,但那以哪?你做到了读书任务,就发生或得工作、事业、生活上之另外作业,将来底公一定比今天底你再成。但是如果未开,以后的您或这的而,让您不快乐的汝。如果看让你开心了,那就算是打响,那看就来含义。

小提琴演奏家帕格尼尼就问了一个儿女,“孩子若干什么喜欢拉小提琴?”孩子回答说,“我思念成,我眷恋成像而同巨大的小提琴演奏家。”

帕格尼尼微笑,再次问到“拉小提琴的早晚你欢喜也?”孩子努力点头,帕格尼尼拍了冲击孩子的头,“世界上产生零星种消费,一栽结果,一栽不结实,往往不结实的复美丽,比如玫瑰,郁金香…他们尚未明白的目的,纯粹的为开自己,他们即是打响之哎。”

后来不怎么男孩将拉小提琴当做乐趣,醉心与狭义相对论和广义相对论。

稍男孩被爱因斯坦。

故事是本身打本人念之老三本书里看看底,挺有趣的。读书不见面叫您一直成,但是,做,做的经过,过程遭到的欢快吗是别一样种植成功。

图转自网易云阅读

此文以笔者原文基础及改整理而成。

3.1年读365依最扯了,走马观花,有意向也?

当时就是前方我干的忧患的来由。

自我所以担忧是坐自身为无知晓这样的方式是否来意图?为什么不理解,因为自己吗是刚刚开始,并且仅进行到100天读33本的起来阶段,我无明白能不能够做到后续之路,后续的品是否中更无晓。但是自还以坚持,并且职能比预料的要好。

因而说效益好,是盖看的当下几乎上自己之状态比较原先好了多,面对工作在及的题材易的对立冷清平静起来。我不再担心多做的要命少,不再纠结如何快速完成目标,而是慢慢的去适应,适应在过程遭到寻觅快乐与成就感。

关于1年读365本书是免是最最走马观花,我有例外的意。《书都非见面宣读,你还眷恋成功》书里提到的这种措施,是阅读上高级阶段的点子,而休是一律开始即要求阅读的法门。

1年读365仍多半是外提的均等种概念,书被的翻阅方法是稳中求进的,先是同全面读两按,然后100龙读33论,然后同年读100准及标准相关的图书,然后采访10各类来了题的中标的CEO(上次自家之读书笔记里没提到,是为个人认为就不是新手阶段的我们欠考虑的事务。这么做的目的和意向大家好去《书还无思读,你还想成》里去寻找),然后读与友好专业无关但是来义的书,最后的结尾才是1年读365依。

胡是最终,因为急需事先养成习惯,学会方法,让投机有足够的业内力量,足够的知储备,形成足够密集与广泛的知识网,才发或好1年读365本书,取书中精华,去书写中糟粕,那样才会不走马观花,而有效。

图表转自网易云阅读

报错如下:

昨天,吃罢饭回家,打开简书,意外的觉察简友圈多了几百长长的提示信息,有些让宠若惊。

诸多模块都叫设置在此处。直接输入pip,还是采取的本原的pip。所以我们的思路是:应该于初的Python中设置pip,这样才未见面报错。

图表发转自网易云看

2.7之模块是在偏下目录

这就是说篇文章下面来这样几修回复给自身印象深刻,都是来与“为什么读书”、“怎么读”、“那本书的读方法是否行得通”等为大家纠结的问题,今天将出去和豪门齐交流一下,兴许对想读的对象小助。

比:脚本的初稿

依据这些恢复我大体分为以下几类:

逢这题材的食指不少,网上博客都是并行抄袭,没有当真解决问题的。有同海外网站为闹了缓解方案:

  • 本身跟作者的状态同样,但是读再多之开无会见为此,也是白扯。
  • 1年读365本书,太扯,走马观花只是浪费时间而已。
  • 自身想读,但是非知底打乌开始。

起这题目是坐:虽然都拿Python升级到了2.7版,但是pip仍然是原先的版本,仍在原python的site-package里面

密切一看,原来是整治公布的如出一辙首关于《书还非会见念,你还眷恋成功》的读书笔记和体会——《1年读365本书,成功当上CEO?》受引进到了首页,并且获得许多对象之支撑,真的非常感谢。

# /usr/lib/python2.6/site-packages/

1年读365据之骇人读书方法到底出无产生意图?

# /usr/local/bin/easy_install pip
# /usr/local/bin/pip -V
pip 9.0.1 from /usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)

2.朗诵再多的书,不见面用啊是纸上谈兵。

夫问题,开始的时刻自己吧想过,也起有对象莫开始阅读的当儿也必会考虑到是题目。为什么说一样片段为,因为还有一些有情人因此“随缘读书法”,就是只将读看成消遣,修身养性用底。我认为这些情侣是使于咱这些纪念只要借着看达到什么“目的”的“病人”要高级部分,因为你们比我们明白的在,这不是酸不拉几的语,是发自内心羡慕的言语,你们真比我们更鲜明自己想如果什么。

拉的发硌多,读书不会见就此怎么处置?

切莫办!读两本书就是想在以了?就想方成功了?太急功近利了。读书是千篇一律种植习惯,一种植沉淀,一种积累,一种准备,是均等项永之政工。如果无要是说利用,那吧是交早晚机会,到自然等级,到自然需要的时节去考虑的事务。至于怎么用,我弗明了,但自知道出开中,网上发出使人采取的计,我本尚从未交用以的时,我事先拿温馨之惯建立起,到需要使用的下再次用出去。怎么动是办法,方法是可以高速学会的,但是积累也非克快速形成。

故而,不心急,先由开起来,先由对降以及顾虑说勿起头

用马云的语说:“宁可战死不可知怕死!”

骨子里个人认为怎样行使为分割众层次,初级的假应用,比如把看到的跟和气眼前需要之整合起来,直接拿过来用,比如上面讲到之好故事,就是自己由别的书中来看底。

重胜似一叠方式方法相互联系的行使,比如《孙子兵法》和市的联系性应用。

重新强一层次之就是考虑齐的下,这种用或是震慑的,让你眼界更广泛,格局还胜,思维更开阔,以此震慑、改变而对问题认识的角度,做出更有效,或者另行能之断。(自己浅薄的知晓,词穷,见识不够,不清楚对非对准。)

图发网易云阅读

 

图转自网易云阅读

# wget https://pypi.python.org/packages/source/s/setuptools/setuptools-3.5.1.zip
# unzip setuptools-3.5.1.zip
# /usr/local/bin/pyton2.7 distribute_setup.py
# /usr/local/lib/python2.7/site-packages

CentOS6.8环境下,默认是python2.6.6,site-package在

# pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

设置生成的有所二进制文件,都是以公的PYTHON_HOME/bin/,因为自身之是设置在/usr/local/python/,所以命令还当此地,以后又调用pip要运用绝对路径,或者开链接!

采用初本子的python来运转此剧本,这个会活动装出来一个easy_install,然后用这个新的easy_install来设置pip就得了!

#!python
"""Bootstrap distribute installation

If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::

    from distribute_setup import use_setuptools
    use_setuptools()

If you want to require a specific version of setuptools, set a download
mirror, or use an alternate download directory, you can do so by supplying
the appropriate options to ``use_setuptools()``.

This file can also be run as a script to install or upgrade setuptools.
"""
import os
import shutil
import sys
import time
import fnmatch
import tempfile
import tarfile
import optparse

from distutils import log

try:
    from site import USER_SITE
except ImportError:
    USER_SITE = None

try:
    import subprocess

    def _python_cmd(*args):
        args = (sys.executable,) + args
        return subprocess.call(args) == 0

except ImportError:
    # will be used for python 2.3
    def _python_cmd(*args):
        args = (sys.executable,) + args
        # quoting arguments if windows
        if sys.platform == 'win32':
            def quote(arg):
                if ' ' in arg:
                    return '"%s"' % arg
                return arg
            args = [quote(arg) for arg in args]
        return os.spawnl(os.P_WAIT, sys.executable, *args) == 0

DEFAULT_VERSION = "0.6.49"
DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
SETUPTOOLS_FAKED_VERSION = "0.6c11"

SETUPTOOLS_PKG_INFO = """\
Metadata-Version: 1.0
Name: setuptools
Version: %s
Summary: xxxx
Home-page: xxx
Author: xxx
Author-email: xxx
License: xxx
Description: xxx
""" % SETUPTOOLS_FAKED_VERSION

def _install(tarball, install_args=()):
    # extracting the tarball
    tmpdir = tempfile.mkdtemp()
    log.warn('Extracting in %s', tmpdir)
    old_wd = os.getcwd()
    try:
        os.chdir(tmpdir)
        tar = tarfile.open(tarball)
        _extractall(tar)
        tar.close()

        # going in the directory
        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
        os.chdir(subdir)
        log.warn('Now working in %s', subdir)

        # installing
        log.warn('Installing Distribute')
        if not _python_cmd('setup.py', 'install', *install_args):
            log.warn('Something went wrong during the installation.')
            log.warn('See the error message above.')
            # exitcode will be 2
            return 2
    finally:
        os.chdir(old_wd)
        shutil.rmtree(tmpdir)

def _build_egg(egg, tarball, to_dir):
    # extracting the tarball
    tmpdir = tempfile.mkdtemp()
    log.warn('Extracting in %s', tmpdir)
    old_wd = os.getcwd()
    try:
        os.chdir(tmpdir)
        tar = tarfile.open(tarball)
        _extractall(tar)
        tar.close()

        # going in the directory
        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
        os.chdir(subdir)
        log.warn('Now working in %s', subdir)

        # building an egg
        log.warn('Building a Distribute egg in %s', to_dir)
        _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)

    finally:
        os.chdir(old_wd)
        shutil.rmtree(tmpdir)
    # returning the result
    log.warn(egg)
    if not os.path.exists(egg):
        raise IOError('Could not build the egg.')

def _do_download(version, download_base, to_dir, download_delay):
    egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg'
                       % (version, sys.version_info[0], sys.version_info[1]))
    if not os.path.exists(egg):
        tarball = download_setuptools(version, download_base,
                                      to_dir, download_delay)
        _build_egg(egg, tarball, to_dir)
    sys.path.insert(0, egg)
    import setuptools
    setuptools.bootstrap_install_from = egg

def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
                   to_dir=os.curdir, download_delay=15, no_fake=True):
    # making sure we use the absolute path
    to_dir = os.path.abspath(to_dir)
    was_imported = 'pkg_resources' in sys.modules or \
        'setuptools' in sys.modules
    try:
        try:
            import pkg_resources

            # Setuptools 0.7b and later is a suitable (and preferable)
            # substitute for any Distribute version.
            try:
                pkg_resources.require("setuptools>=0.7b")
                return
            except (pkg_resources.DistributionNotFound,
                    pkg_resources.VersionConflict):
                pass

            if not hasattr(pkg_resources, '_distribute'):
                if not no_fake:
                    _fake_setuptools()
                raise ImportError
        except ImportError:
            return _do_download(version, download_base, to_dir, download_delay)
        try:
            pkg_resources.require("distribute>=" + version)
            return
        except pkg_resources.VersionConflict:
            e = sys.exc_info()[1]
            if was_imported:
                sys.stderr.write(
                "The required version of distribute (>=%s) is not available,\n"
                "and can't be installed while this script is running. Please\n"
                "install a more recent version first, using\n"
                "'easy_install -U distribute'."
                "\n\n(Currently using %r)\n" % (version, e.args[0]))
                sys.exit(2)
            else:
                del pkg_resources, sys.modules['pkg_resources']    # reload ok
                return _do_download(version, download_base, to_dir,
                                    download_delay)
        except pkg_resources.DistributionNotFound:
            return _do_download(version, download_base, to_dir,
                                download_delay)
    finally:
        if not no_fake:
            _create_fake_setuptools_pkg_info(to_dir)

def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
                        to_dir=os.curdir, delay=15):
    """Download distribute from a specified location and return its filename

    `version` should be a valid distribute version number that is available
    as an egg for download under the `download_base` URL (which should end
    with a '/'). `to_dir` is the directory where the egg will be downloaded.
    `delay` is the number of seconds to pause before an actual download
    attempt.
    """
    # making sure we use the absolute path
    to_dir = os.path.abspath(to_dir)
    try:
        from urllib.request import urlopen
    except ImportError:
        from urllib2 import urlopen
    tgz_name = "distribute-%s.tar.gz" % version
    url = download_base + tgz_name
    saveto = os.path.join(to_dir, tgz_name)
    src = dst = None
    if not os.path.exists(saveto):  # Avoid repeated downloads
        try:
            log.warn("Downloading %s", url)
            src = urlopen(url)
            # Read/write all in one block, so we don't create a corrupt file
            # if the download is interrupted.
            data = src.read()
            dst = open(saveto, "wb")
            dst.write(data)
        finally:
            if src:
                src.close()
            if dst:
                dst.close()
    return os.path.realpath(saveto)

def _no_sandbox(function):
    def __no_sandbox(*args, **kw):
        try:
            from setuptools.sandbox import DirectorySandbox
            if not hasattr(DirectorySandbox, '_old'):
                def violation(*args):
                    pass
                DirectorySandbox._old = DirectorySandbox._violation
                DirectorySandbox._violation = violation
                patched = True
            else:
                patched = False
        except ImportError:
            patched = False

        try:
            return function(*args, **kw)
        finally:
            if patched:
                DirectorySandbox._violation = DirectorySandbox._old
                del DirectorySandbox._old

    return __no_sandbox

def _patch_file(path, content):
    """Will backup the file then patch it"""
    f = open(path)
    existing_content = f.read()
    f.close()
    if existing_content == content:
        # already patched
        log.warn('Already patched.')
        return False
    log.warn('Patching...')
    _rename_path(path)
    f = open(path, 'w')
    try:
        f.write(content)
    finally:
        f.close()
    return True

_patch_file = _no_sandbox(_patch_file)

def _same_content(path, content):
    f = open(path)
    existing_content = f.read()
    f.close()
    return existing_content == content

def _rename_path(path):
    new_name = path + '.OLD.%s' % time.time()
    log.warn('Renaming %s to %s', path, new_name)
    os.rename(path, new_name)
    return new_name

def _remove_flat_installation(placeholder):
    if not os.path.isdir(placeholder):
        log.warn('Unkown installation at %s', placeholder)
        return False
    found = False
    for file in os.listdir(placeholder):
        if fnmatch.fnmatch(file, 'setuptools*.egg-info'):
            found = True
            break
    if not found:
        log.warn('Could not locate setuptools*.egg-info')
        return

    log.warn('Moving elements out of the way...')
    pkg_info = os.path.join(placeholder, file)
    if os.path.isdir(pkg_info):
        patched = _patch_egg_dir(pkg_info)
    else:
        patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO)

    if not patched:
        log.warn('%s already patched.', pkg_info)
        return False
    # now let's move the files out of the way
    for element in ('setuptools', 'pkg_resources.py', 'site.py'):
        element = os.path.join(placeholder, element)
        if os.path.exists(element):
            _rename_path(element)
        else:
            log.warn('Could not find the %s element of the '
                     'Setuptools distribution', element)
    return True

_remove_flat_installation = _no_sandbox(_remove_flat_installation)

def _after_install(dist):
    log.warn('After install bootstrap.')
    placeholder = dist.get_command_obj('install').install_purelib
    _create_fake_setuptools_pkg_info(placeholder)

def _create_fake_setuptools_pkg_info(placeholder):
    if not placeholder or not os.path.exists(placeholder):
        log.warn('Could not find the install location')
        return
    pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
    setuptools_file = 'setuptools-%s-py%s.egg-info' % \
            (SETUPTOOLS_FAKED_VERSION, pyver)
    pkg_info = os.path.join(placeholder, setuptools_file)
    if os.path.exists(pkg_info):
        log.warn('%s already exists', pkg_info)
        return

    log.warn('Creating %s', pkg_info)
    try:
        f = open(pkg_info, 'w')
    except EnvironmentError:
        log.warn("Don't have permissions to write %s, skipping", pkg_info)
        return
    try:
        f.write(SETUPTOOLS_PKG_INFO)
    finally:
        f.close()

    pth_file = os.path.join(placeholder, 'setuptools.pth')
    log.warn('Creating %s', pth_file)
    f = open(pth_file, 'w')
    try:
        f.write(os.path.join(os.curdir, setuptools_file))
    finally:
        f.close()

_create_fake_setuptools_pkg_info = _no_sandbox(
    _create_fake_setuptools_pkg_info
)

def _patch_egg_dir(path):
    # let's check if it's already patched
    pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
    if os.path.exists(pkg_info):
        if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):
            log.warn('%s already patched.', pkg_info)
            return False
    _rename_path(path)
    os.mkdir(path)
    os.mkdir(os.path.join(path, 'EGG-INFO'))
    pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
    f = open(pkg_info, 'w')
    try:
        f.write(SETUPTOOLS_PKG_INFO)
    finally:
        f.close()
    return True

_patch_egg_dir = _no_sandbox(_patch_egg_dir)

def _before_install():
    log.warn('Before install bootstrap.')
    _fake_setuptools()

def _under_prefix(location):
    if 'install' not in sys.argv:
        return True
    args = sys.argv[sys.argv.index('install') + 1:]
    for index, arg in enumerate(args):
        for option in ('--root', '--prefix'):
            if arg.startswith('%s=' % option):
                top_dir = arg.split('root=')[-1]
                return location.startswith(top_dir)
            elif arg == option:
                if len(args) > index:
                    top_dir = args[index + 1]
                    return location.startswith(top_dir)
        if arg == '--user' and USER_SITE is not None:
            return location.startswith(USER_SITE)
    return True

def _fake_setuptools():
    log.warn('Scanning installed packages')
    try:
        import pkg_resources
    except ImportError:
        # we're cool
        log.warn('Setuptools or Distribute does not seem to be installed.')
        return
    ws = pkg_resources.working_set
    try:
        setuptools_dist = ws.find(
            pkg_resources.Requirement.parse('setuptools', replacement=False)
            )
    except TypeError:
        # old distribute API
        setuptools_dist = ws.find(
            pkg_resources.Requirement.parse('setuptools')
        )

    if setuptools_dist is None:
        log.warn('No setuptools distribution found')
        return
    # detecting if it was already faked
    setuptools_location = setuptools_dist.location
    log.warn('Setuptools installation detected at %s', setuptools_location)

    # if --root or --preix was provided, and if
    # setuptools is not located in them, we don't patch it
    if not _under_prefix(setuptools_location):
        log.warn('Not patching, --root or --prefix is installing Distribute'
                 ' in another location')
        return

    # let's see if its an egg
    if not setuptools_location.endswith('.egg'):
        log.warn('Non-egg installation')
        res = _remove_flat_installation(setuptools_location)
        if not res:
            return
    else:
        log.warn('Egg installation')
        pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')
        if (os.path.exists(pkg_info) and
            _same_content(pkg_info, SETUPTOOLS_PKG_INFO)):
            log.warn('Already patched.')
            return
        log.warn('Patching...')
        # let's create a fake egg replacing setuptools one
        res = _patch_egg_dir(setuptools_location)
        if not res:
            return
    log.warn('Patching complete.')
    _relaunch()

def _relaunch():
    log.warn('Relaunching...')
    # we have to relaunch the process
    # pip marker to avoid a relaunch bug
    _cmd1 = ['-c', 'install', '--single-version-externally-managed']
    _cmd2 = ['-c', 'install', '--record']
    if sys.argv[:3] == _cmd1 or sys.argv[:3] == _cmd2:
        sys.argv[0] = 'setup.py'
    args = [sys.executable] + sys.argv
    sys.exit(subprocess.call(args))

def _extractall(self, path=".", members=None):
    """Extract all members from the archive to the current working
       directory and set owner, modification time and permissions on
       directories afterwards. `path' specifies a different directory
       to extract to. `members' is optional and must be a subset of the
       list returned by getmembers().
    """
    import copy
    import operator
    from tarfile import ExtractError
    directories = []

    if members is None:
        members = self

    for tarinfo in members:
        if tarinfo.isdir():
            # Extract directories with a safe mode.
            directories.append(tarinfo)
            tarinfo = copy.copy(tarinfo)
            tarinfo.mode = 448  # decimal for oct 0700
        self.extract(tarinfo, path)

    # Reverse sort directories.
    if sys.version_info < (2, 4):
        def sorter(dir1, dir2):
            return cmp(dir1.name, dir2.name)
        directories.sort(sorter)
        directories.reverse()
    else:
        directories.sort(key=operator.attrgetter('name'), reverse=True)

    # Set correct owner, mtime and filemode on directories.
    for tarinfo in directories:
        dirpath = os.path.join(path, tarinfo.name)
        try:
            self.chown(tarinfo, dirpath)
            self.utime(tarinfo, dirpath)
            self.chmod(tarinfo, dirpath)
        except ExtractError:
            e = sys.exc_info()[1]
            if self.errorlevel > 1:
                raise
            else:
                self._dbg(1, "tarfile: %s" % e)

def _build_install_args(options):
    """
    Build the arguments to 'python setup.py install' on the distribute package
    """
    install_args = []
    if options.user_install:
        if sys.version_info < (2, 6):
            log.warn("--user requires Python 2.6 or later")
            raise SystemExit(1)
        install_args.append('--user')
    return install_args

def _parse_args():
    """
    Parse the command line for options
    """
    parser = optparse.OptionParser()
    parser.add_option(
        '--user', dest='user_install', action='store_true', default=False,
        help='install in user site package (requires Python 2.6 or later)')
    parser.add_option(
        '--download-base', dest='download_base', metavar="URL",
        default=DEFAULT_URL,
        help='alternative URL from where to download the distribute package')
    options, args = parser.parse_args()
    # positional arguments are ignored
    return options

def main(version=DEFAULT_VERSION):
    """Install or upgrade setuptools and EasyInstall"""
    options = _parse_args()
    tarball = download_setuptools(download_base=options.download_base)
    return _install(tarball, _build_install_args(options))

if __name__ == '__main__':
    sys.exit(main())