Hướng dẫn install wheel python
Try a faster and easier way to build Python from source code. Use Python 3.9 by ActiveState and build your own runtime with the packages and dependencies you need. Get started for free by creating an account on the ActiveState Platform or logging in with your GitHub account. Show Python Install WheelOpen source Python packages can be installed from Source Distributions (sdist) or Wheels (whl). According to the Python Packaging Authority (PyPA), wheels are the preferred way that pip installs Python modules from the Python Package Index (PyPI) because they’re smaller, faster to install, and more efficient than building the package from the source code contained in an sdist. Additionally, most developers simply don’t have the right tooling and experience to build everything from source code themselves. Wheels provide a great shortcut. Pip will install all “flavors” of wheels, including:
How to Pip Install WheelsThere’s no need to specify that you want to install a wheel. By default, pip will always attempt to install a wheel unless there is no whl file for your operating system, at which point pip will attempt to build the wheel from the sdist (note that this can fail if you don’t have the appropriate resources and requirements on your system). Assuming you don’t first need to install Python from python.org, you can install a wheel by running the following command: pip install To install a specific version of a package, run the following command: pip install For example: pip install django==3.1.13 To install a package from a repository other than PyPI, such as Github: pip install -e git+ To upgrade a package that is already installed: pip install --upgrade To uninstall a package: pip uninstall How to Download WheelsMost packages provide multiple wheels – one for each version of Python and operating system the author supports. If you’re pre-populating a private repository behind the firewall in your organization, you may want to download multiple wheels since your developers may be working on different operating systems. To download Python wheels to a specific location (–dest, which is typically a dir), run the following command: python -m pip download --only-binary :all: --dest . --no-cache Rather than pre-populating a repository with the wheels you want to restrict your developers to using, you can save considerable time and effort by using a pre-populated repository like ActiveState’s Artifact Repository (AAR). AAR can be pre-populated with Windows and/or Linux wheels for Python 3.9 or later. AAR is part of the ActiveState Platform, which you can try out for free. AAR services are available at the Enterprise Tier. See ActiveState Platform Pricing for more information. How to Build Python WheelsWhen it comes to Python packaging, if your package consists purely of Python code, you can do the following:
This will create both a source distribution (sdist) and a wheel file (bdist_wheel) , along with all of its dependencies. You can now upload your built distributions to PyPI. For more information, see Sharing Your Labor of Love: PyPI Quick and Dirty. If your package has linked C libraries, you’ll need to create specific build environments, and then compile your package separately for each target operating system you want to support. Wheel NamingWheels have a specific syntax for their filename that consists of multiple parts separated by a hyphen: {dist}-{version}(-{build})?-{python.version}-{os_platform}.whl Each part provides a clue as to what the wheel contains and where it can be deployed. For example: “PyYAML-5.3.1-cp27-cp27m-win32.whl” for deployment with Python 2.7 on 32 bit Windows Or “PyYAML-5.3.1-cp35-cp35m-win_amd64.whl” for deployment with Python 3.5 on Windows with 64-bit AMD architecture Or Pandas-1.3.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl for deployment with Python 3.7 on multiple Linux versions, such as Ubuntu, Debian, CentOS, Fedora, etc. Note: “manylinux” is essentially a Docker image that comes bundled with a compiler suite, multiple versions of Python and pip, and an allowed set of shared libraries. Building Python from source code? Try ActiveState’s PlatformThe ActiveState Platform gives you access to a distributed, parallel build system so that even complex development environments can be automatically built and packaged for your OS in record time—straight from source code—giving you all the security assurances and flexibility that comes with it. Dependency resolution is at the core of the ActiveState Platform. When you create a project and start adding requirements, the Platforms tell you what dependencies those requirements have. The ActiveState Platform is a cloud-based build tool for Python. It provides build automation and vulnerability remediation for:
Get a hands-on appreciation for how the ActiveState Platform can help you manage your dependencies for Python environments. Just run the following command to install Python 3.9 and our package manager, the State Tool: Windows powershell -Command "& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.activestate.com/dl/cli/install.ps1'))) -activate-default ActiveState-Labs/Python-3.9Beta" Linux sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) --activate-default ActiveState-Labs/Python-3.9Beta Now you can run state install Let us know your experience in the ActiveState Community forum. Watch this video to learn how to use the ActiveState Platform to create a Python 3.9 environment, and then use the Platform’s CLI (State Tool) to install and manage it. |