The usage of wheel in python

Python's first mainstream packaging format was the .egg file, and now there is a new member called Wheel (*.whl) in the big family. wheel "is designed to contain all files for PEP 376 compatible installation (a format very close to the on-disk format)". In this article, we will learn how to create a wheel and how to install a wheel in a virtualenv.

Get started

You need pip to create a wheel. To learn to install pip, I strongly recommend reading the pip installation page

. If you have already installed pip, then you need to upgrade it to the latest version. You only need to do this: In a console window, enter the following command:

pip install --upgrade pip

After completing the above work, we are ready to learn to create a wheel!

Create wheel

First, you need to install the wheel package:

pip install wheel

In the next step, we will use the unidecode package to create our first wheel, because when I am writing this article, our wheel package has not been created yet, and I will use this package in multiple projects next.

pip wheel --wheel-dir=my_wheels Unidecode

Now, you have a wheel named Unidecode-0.04.14-py26-none-any.whl in the my_wheels folder, let's learn to install the newly created wheel!

Install Python

wheel

Let's create a virtualenv

For testing, you can read more about virtualenv here. Once you have installed virtualenv, use the following command to test:

virtualenv test

This will create a testable virtual sandbox for us with pip. Before proceeding to the next step, make sure to run activate in the s folder to enable virtualenv. Now virtualenv does not include wheel, so you need to install wheel again:

pip install wheel

Once the wheel is installed, we use the following command to install the wheel we created earlier:

pip install --use-wheel --no-index --find-links=path/to/my_wheels Unidecode

In order to test whether it is running properly, run Python from the s folder of your virtualenv and try to import unidecode. If it is imported normally, then you have successfully installed the wheel you created before!

Note: I installed a troublesome old version of virtualenv when I started. Make sure you upgraded to the latest version, or you spent a lot of time tossing to make it work.

*. The whl files are similar to *.egg files: in fact they are all "disguised" *.zip files. If you change the *.whl file name extension to *.zip, you can open it with your zip application and view the files and folders it contains.

to sum up

Now you are ready to create your own wheel, which is like a great way to create a local warehouse for your own quick installation projects. You can create multiple different wheel warehouses, which is the same as switching between different test versions. When combined with virtualenv, you will have a very convenient method through which you can see how the new version's dependencies can affect your project without downloading them multiple times.

Knowledge point expansion:

Python wheel package file name format

0.12.4 – Package version

cp36-python implementation and version, cp:CPython. ip:IronPython, jy:Jython, orpp: PyPy, version: 3.6.

cp36m -abi tag

win_amd64-system platform tag

So far, this article on the usage of wheel in python is introduced. For more related python wheel, please search for the previous articles of ZaLou.Cn or continue to browse the related articles below. Hope you will support ZaLou.Cn more in the future. !

Recommended Posts

The usage of wheel in python
The usage of tuples in python
The usage of Ajax in Python3 crawler
The meaning and usage of lists in python
Detailed usage of dictionary in Python
Usage of os package in python
Understanding the meaning of rb in python
MongoDB usage in Python
What is the function of adb in python
The usage of several regular expressions in Linux
Python implements the shuffling of the cards in Doudizhu
The usage of several regular expressions in Linux
Detailed explanation of the usage of Python decimal module
The usage of several regular expressions in Linux
The consequences of uninstalling python in ubuntu, very
Consolidate the foundation of Python (4)
Consolidate the foundation of Python(7)
Subscripts of tuples in Python
Consolidate the foundation of Python(6)
Consolidate the foundation of Python(5)
Consolidate the foundation of Python (3)
How to understand the introduction of packages in Python
Summary of logarithm method in Python
Analysis of usage examples of Python yield
Use of Pandas in Python development
How to find the area of a circle in python
Learn the hard core operation of Python in one minute
Python handles the 4 wheels of Chinese
Use of numpy in Python development
Python simulation of the landlord deal
What is the use of Python
​What are the numbers in Python?
Simple usage of python definition class
Talking about the modules in Python
The premise of Python string pooling
Secrets of the new features of Python 3.8
The father of Python joins Microsoft
The operation of python access hdfs
End the method of running python
Description of in parameterization in python mysql
Can Python implement the structure of the stack?
Learn the basics of python interactive mode
What are the required parameters of python
Implementation of JWT user authentication in python
Logistic regression at the bottom of python
Python solves the Tower of Hanoi game
Solve the conflict of multiple versions of python
What is the scope of python variables
Python implements the sum of fractional sequences
Two days of learning the basics of Python
What is the id function of python
Analysis of glob in python standard library
Where is the pip path of python3
Method of installing django module in python
The essence of Python language: Itertools library
What are the advantages of python language
The specific method of python instantiation object
python3 realizes the function of mask drawing
What is the prospect of python development
Detailed usage of Python virtual environment venv
What is the function body of python