Python 工具v简介

发布时间:2019-08-12 09:51:44编辑:auto阅读(1924)

    一、pip工具:https://pypi.python.org/pypi/pip


    快速入门:

    1、安装包

    $ pip install SomePackage
      [...]
      Successfully installed SomePackage

    2、查看安装了哪些文件

    $ pip show --files SomePackage
      Name: SomePackage
      Version: 1.0
      Location: /my/env/lib/pythonx.x/site-packages
      Files:
       ../somepackage/__init__.py
       [...]

    3、显示哪些包已经过时:

    $ pip list --outdated
      SomePackage (Current: 1.0 Latest: 2.0)

    4、升级某个包:

    $ pip install --upgrade SomePackage
      [...]
      Found existing installation: SomePackage 1.0
      Uninstalling SomePackage:
        Successfully uninstalled SomePackage
      Running setup.py install for SomePackage
      Successfully installed SomePackage

    5、卸载某个包

    $ pip uninstall SomePackage
      Uninstalling SomePackage:
        /my/env/lib/pythonx.x/site-packages/somepackage
      Proceed (y/n)? y
      Successfully uninstalled SomePackage

    工具安装:(ubuntu 12.04)

         sudo apt-get install python-pip


    二、distribute工具

    下载https://pypi.python.org/pypi/distribute/0.7.3

    unzip解压

    进入目录下执行:

    sudo python setup.py install


    三、nose工具

    安装说明:http://nose.readthedocs.org/en/latest/

    sudo easy_install nose

    获取帮助 nosetests -h


    四、virtualenv工具

    https://virtualenv.pypa.io/en/latest/virtualenv.html

    sudo pip install virtualenv


    使用:

    $ virtualenv ENV

    This creates ENV/lib/pythonX.X/site-packages, where any libraries you install will go. It also creates ENV/bin/python, which is a Python interpreter that uses this environment. Anytime you use that interpreter (including when a script has #!/path/to/ENV/bin/python in it) the libraries in that environment will be used.

    It also installs Setuptools into the environment.

    链接:

    1. pip from http://pypi.python.org/pypi/pip

    2. distribute from http://pypi.python.org/pypi/distribute

    3. nose from http://pypi.python.org/pypi/nose/

    4. virtualenv from http://pypi.python.org/pypi/virtualenv


关键字

上一篇: python的json库

下一篇: python vimrc设置