pip install PIL doesn't install into virtualenv

后端 未结 2 1310
执念已碎
执念已碎 2020-12-12 14:11

How do I install PIL?

>pip install PIL

Downloading/unpacking PIL
  Could not find any downloads that satisfy the requirement PIL  
  Some externally host         


        
相关标签:
2条回答
  • 2020-12-12 14:49

    Updated info for those reading in 2016:

    --allow-external
    

    and

    --allow-unverified
    

    were recently deprecated. Installing packages external to PyPi using pip is no longer supported: http://www.python.org/dev/peps/pep-0470/

    As an alternative, when you really need to install that external package, you can download the source code and run its setup.py. For example, for PIL 1.1.7, download from http://www.pythonware.com/products/pil/, then:

    $ tar xvfz Imaging-1.1.7.tar.gz
    $ cd Imaging-1.1.7
    $ python setup.py install
    

    (^ from the PIL README)

    If you only want to install the package to a specific virtualenv, you can just activate your virtualenv first. ** thanks @Caumons

    Alternatively, substitute the path to your virtualenv for 'python' in the third line, e.g.:

    $ /home/username/virtualenv-name/bin/python setup.py install
    
    0 讨论(0)
  • 2020-12-12 15:00

    pip install PIL --allow-external PIL --allow-unverified PIL

    This is due to changes in the new version of Pip. Run pip --version and I'm willing to bet you are running 1.5. See the changelog here. This new default behavior enhances security. In PIL's case, the file you are installing actually comes from effbot.org (thus --allow-external) and PyPi doesn't have a checksum to guarantee validity (thus --allow-unverified).

    Also, you might consider using the Pillow replacement to PIL.

    0 讨论(0)
提交回复
热议问题