How to install external host files with Pip in Python

Source: Internet
Author: User
Tags deprecated

There are three ways to install a non-self-contained Python module in Python:

    • Easy_install
    • Pip
    • Unzip after downloading the compressed package (. zip,. tar,. tar.gz), and execute the Python setup.py install command after entering the extracted directory

This article focuses on a scenario that may be encountered when PIP is installed, and the workaround:

If I want to install the Pylint module, the module non-Python module, with import must not import, requires additional installation

>>> Import Pylinttraceback (most recent):  File ' <stdin> ', line 1, in <module>importerr Or:no module named Pylint
" phenomenon "

Execute pip Install <modulename> command with the following error:

D:\>pip Install Pylint--allow-external pylintdownloading/unpacking pylintrequirement already satisfied (use-- Upgrade to upgrade): Six in C:\python27\lib\site-packages\six-1.8.0-py2.7.egg (from Pylint) downloading/unpacking astroid>=1.3.6 (from Pylint)  Real name of Requirement astroid are astroid  Could not find any downloads that Sati SFY the requirement astroid>=1.3.6 (from Pylint)  Some insecure and unverifiable files were ignored (use--ALLOW-UNV Erified astroid to allow). Cleaning up ... No distributions at all found for astroid>=1.3.6 (from pylint) storing debug log for failure in C:\Users\aaa\pip\pip.log
" Analysis"

Installation of new modules in Perl, generally can be used in ppm graphical tools, can also be installed with CPAN, such as: cpan> installtest::class, very convenient, do not encounter this situation, this situation is mainly due to the PIP version problem: The latest version of PIP (1.5 or more), for a secure test

The PIP does not allow the installation of a non-pypi URL because the installation file is actually from pylint.org, resulting in the error above!

Note:

1. You can view the changed information in the official Changelog

2. You can use PIP--version to view the version information of the PIP

C:\>pip--versionpip 1.5.6 from C:\Python27\lib\site-packages (Python 2.7)

" approach "

For the above scenario, since this issue is due to the PIP version, you can use a lower version of PIP instead

method One: use the PIP 1.4 version, then execute the PIP install pylint command to install

method Two: when executing the command, add--allow-all-external,--allow-unverified and dependent package version (astroid==1.3.6)

Pip install pylint--allow-all-external pylint astroid==1.3.6--allow-unverified pylint

Note:

1. --allow-all-external # allows all external address tags, only the label pip to download the external address module

2. --allow-unverified # pip has no way to verify the validity of the external module, so it must be labeled at the same time

3. astroid==1.3.6 # Dependent package must be added and given its version number, PIP can be downloaded from the list


method Three: in the current directory, the new requirements.txt, the content is as follows:

# requirements.txt--allow-all-external pylint--allow-unverified pylintpylint--allow-all-external astroid==1.3.6
re-execution: pip install-r requirements.txt

" Conclusion "

1. Pip is not a friendly design, it is very inconvenient to use, far less than the PPM in Perl, expecting a tool in Python.

2. If this error is encountered, the module can not be installed: Download the compressed package directly installed. >>> Download Package Address <<<

3. Execute the pip-h command to view updated PIP-related Help information

USAGE:PIP <command> [options]commands:install install packages.  Uninstall Uninstall packages.  Freeze Output installed packages in requirements format.  List List installed packages.  Show show information about installed packages.  Search Search PyPI for packages.  Wheel Build wheels from your requirements. Zip DEPRECATED.  Zip individual packages. Unzip DEPRECATED.  Unzip individual packages. Bundle DEPRECATED.  Create Pybundles. Help Show Help for commands.  General Options:-H,--help Show help. -V,--verbose Give more output.  Option is additive, and can are used up to 3 times.  -V,--version Show version and exit.  -Q,--quiet Give less output.     --log-file <path>      Path to a verbose non-appending log, which is only logs failures.  This log was active by default at Pip.log. --log <path> Path to a verbose appending log.  This log was inactive by default.  --proxy <proxy> Specify a proxy in the form [User:[email protected]]proxy.server:port.  --timeout <sec> Set The socket timeout (default seconds).  --exists-action <action> Default Action when a path already exists: (s) witch, (i) Gnore, (W) Ipe, (b) ackup. --cert <path> Path to alternate CA bundle.









How to install external host files with Pip in Python

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.