Dealing with multiple Python versions and PIP?

后端 未结 23 2782
走了就别回头了
走了就别回头了 2020-11-21 06:58

Is there any way to make pip play well with multiple versions of Python? For example, I want to use pip to explicitly install things to either my s

23条回答
  •  孤独总比滥情好
    2020-11-21 07:33

    So apparently there are multiple versions of easy_install and pip. It seems to be a big mess. Anyway, this is what I did to install Django for Python 2.7 on Ubuntu 12.10:

    $ sudo easy_install-2.7 pip
    Searching for pip
    Best match: pip 1.1
    Adding pip 1.1 to easy-install.pth file
    Installing pip-2.7 script to /usr/local/bin
    
    Using /usr/lib/python2.7/dist-packages
    Processing dependencies for pip
    Finished processing dependencies for pip
    
    $ sudo pip-2.7 install django
    Downloading/unpacking django
      Downloading Django-1.5.1.tar.gz (8.0Mb): 8.0Mb downloaded
      Running setup.py egg_info for package django
    
        warning: no previously-included files matching '__pycache__' found under directory '*'
        warning: no previously-included files matching '*.py[co]' found under directory '*'
    Installing collected packages: django
      Running setup.py install for django
        changing mode of build/scripts-2.7/django-admin.py from 644 to 755
    
        warning: no previously-included files matching '__pycache__' found under directory '*'
        warning: no previously-included files matching '*.py[co]' found under directory '*'
        changing mode of /usr/local/bin/django-admin.py to 755
    Successfully installed django
    Cleaning up...
    
    $ python
    Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
    [GCC 4.7.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import django
    >>> 
    

提交回复
热议问题