This article mainly introduces the Python pip installed PyPI official website Third-party Library method, pip the latest version (more than 1.5 version), for security reasons, the PIP does not allow the installation of PyPI URLs, this article gives two solutions, the need for friends can refer to the
There are three different ways to install a non-Self Python module in Python:
1.easy_install
2.pip
3. Download the compressed package (. zip,. tar,. tar.gz) after decompression, into the uncompressed directory to execute the Python setup.py install command
This article is mainly about the PIP installation may encounter a situation, and the solution:
If I want to install the Pylint module, this module is not a Python self-contained module, with import definitely cannot import, need additional installation
The code is as follows:
>>> Import Pylint
Traceback (most recent call last):
File " ", line 1, in
Importerror:no module named Pylint
Phenomenon
Execute pip Install command with the following error:
The code is as follows:
D:>pip Install Pylint--allow-external pylint
Downloading/unpacking Pylint
Requirement already satisfied (use--upgrade to upgrade): six in C:python27libsite-packagessix-1
.8.0-py2.7.egg (from Pylint)
Downloading/unpacking astroid>=1.3.6 (from Pylint)
Real name of Requirement astroid is astroid
Could not find any downloads this satisfy the requirement astroid>=1.3.6 (from Pylint)
Some insecure and unverifiable files were ignored (use--allow-unverified astroid to allow).
Cleaning up ...
No distributions at all found to astroid>=1.3.6 (from Pylint)
Storing debug log for failure in C:usersaaapippip.log
Analysis
Installing new modules in Perl can typically be used with PPM graphical tools, or CPAN, such as Cpan>install Test::class, which is very handy and does not run into this situation, mainly because of the PIP version problem: The latest version of Pip ( More than 1.5 versions), for the safety of the test
The PIP does not allow you to install a PyPI URL because the installation file actually comes from pylint.org, causing the above error!
Note:
1. Can view the change information in the official Changelog
2. You can use the PIP--version to view the PIP version information
The code is as follows:
C:>pip--version
Pip 1.5.6 from C:python27libsite-packages (Python 2.7)
Way
For the above scenario, since the issue is due to the PIP version, you can switch to the PIP lower version
Method One: Use PIP version 1.4, then perform 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)
The code is as follows:
Pip install pylint--allow-all-external pylint astroid==1.3.6--allow-unverified pylint
Note:
1.--allow-all-external # allows all external address labels to be downloaded only on 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 # The dependency pack must be added and given its version number, the PIP side can download from the list
Method Three: Under the current directory, add the Requirements.txt, the contents are as follows:
The code is as follows:
# Requirements.txt
--allow-all-external Pylint
--allow-unverified Pylint
Pylint
--allow-all-external astroid==1.3.6
Re-execution: Pip Install-r requirements.txt
Conclusion
1. Pip is not user-friendly and inconvenient to use, far less than the PPM in Perl and is expected to have a tool in Python.
2. If you encounter such a mistake, resulting in the inability to install the module: Download the compression package installed well. >>> Download Package Address <<<
3. Execute pip-h command to view update PIP related Help information
The code is as follows:
Usage:
Pip [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 being used to the 3 times.
-V,--version show version and exit.
-Q,--quiet give less output.
--log-file Path to a verbose non-appending log, which is only logs failures. This log was active by default at Pip.log.
--log Path to a verbose appending log. This log was inactive by default.
--proxy Specify a proxy in the form [User:passwd@]proxy.server:port.
--timeout Set The socket timeout (default seconds).
--exists-action Default Action when a path already exists: (s) witch, (i) Gnore, (W) Ipe, (b) ackup.
--cert Path to alternate CA bundle.