banner



How To Install Python Package In Visual Studio

The Pip Bundle Manager is the de facto standard for managing Python distributions, and is recommended for installing Python packages for Windows.

Pip is installed automatically with Python 2 (>=2.7.9) and Python three (>=3.4) installations. The pip command has options for installing, upgrading and deleting packages, and can be run from the Windows command line. By default, pip installs packages located in the Python Package Index (PyPI), merely can also install from other indexes. For more information on how to use pip, run into the Pip Package Installation instructions below.

Wheels and Windows

Python packages installed with pip on Windows are typically arranged into 'wheels' prior to installation. A bicycle is a zippo-mode archive that contains all the files necessary for a typical bundle installation. Wheels take a .whl extension, and provide a simpler installation than 'non-wheel' packages.

Depending on the operating organization that a package was built for and built on, the resulting wheel may not include file requirements for Windows. Appveyor offers a hosted continuous integration service that developers can use to packet Python lawmaking for Windows deployments. Wheels built with Appveyor incorporate Windows support by default, and are usually recognizable by their name, eastward.g. packagename-2.eight-cp37-cp37m-win_amd64.whl.

Installation Requirements

Before packages can be installed, ensure that your existing Python installation meets the requirements. Requirements will differ depending on whether you lot installed Python into a virtual environs using venv or virtualenv:

  • Venv automatically installs pip into Python 3.4+ virtual environments
  • Virtualenv automatically installs pip and wheel into Python two.7+ and Python 3.iii+ virtual environments

Note: If you're using some form of enhanced shell such every bit IPython, then prefix the control with the ! character, eastward.one thousand. !pip install < packagename >

  1. Verify that Python is installed:

Open a Windows control window and run the post-obit control to bank check that a suitable Python version is installed:

          python --version        

Output should be like to:

          Python iii.6.half dozen          .        

If Python is non installed, you can download a copy of ActiveState'due south Python, ActivePython , for free.

  1. Verify that Pip is installed:
          pip --version        

Output should be like to pip 19.iii.1 from c:\python36\lib\site-packages\pip (python 3.6)

  1. Update Pip and Bicycle to ensure yous have the latest version installed:
          pip install --upgrade pip wheel        

Pip Bundle Installation

To install a bundle:

          pip install <                      packagename                    >        

To install a bundle from a repository other than PyPI,  for instance, Github:

          pip install -e git+<                      https://github.com/myrepo.git#egg=packagename                    >        

To upgrade a bundle that is already installed:

          pip install --upgrade <                      packagename                    >        

To uninstall a package:

          pip uninstall <                      packagename                    >                  

To show help for pip, including complete command usage and options:

          pip -h          pip --aid        

Pipenv

Pipenv is a new tool for managing dependencies. It uses pip and virtualenv under the hood, and simplifies their usage with a unmarried command line syntax. Similar venv , pipenv automatically creates a separate virtual environment for each project.

To install, upgrade or uninstall packages inside pipenv, merely replace the pip command with pipenv. For example, the following control installs a named package from PyPI:

          pipenv install <                      packagename                    >        

You tin also install packages from locations other than PyPI. For example, the following command installs the requests package from a Github repository:

          pipenv install -e git+https://github.com/requests/requests.git#egg=requests        

Manual Package Installation

About Python packages are at present designed to exist compatible with pip. If you have a package that'south not uniform, then you lot'll need to exercise a manual installation.

How to manually install a Python package:

  1. Download the package and extract it into a local directory.

2a.  If the package came with its ain prepare of installation instructions, they should be followed.

2b.  If not, and then open a command window and cd into the directory, and enter:

          python setup.py install        

How ActiveState Tin Help

ActiveState provides a unified cantankerous-platform toolchain for modern Python package direction. It tin can replace the complex and hard-to-maintain in-house solutions congenital from multiple packet managers, environment management tools and other solutions.

By adopting the ActiveState Platform, developers can:

  • Automatic building of packages from source, including link C libraries without the need for a local build environs.
  • Automatic resolution of dependencies (or suggestions on how to manually resolve conflicts), ensuring that your environment always contains a set of known expert dependencies that work together.
  • Central management of a single source of truth for your environment that can be deployed with a single control to all development and CI/CD environments, ensuring consistent reproducibility.
  • Automated installation of virtual Python environments on Windows or Linux without requiring prior setup.
  • The power to observe, fix and automatically rebuild vulnerable environments, thereby enhancing security and dramatically reducing time and endeavour involved in resolving CVEs.
  • Visually seeing which versions of which packages are canonical for use, thereby taking the guesswork out of development.

Those that prefer to piece of work from the command line can leverage the ActiveState Platform'southward CLI, the State Tool, which acts every bit a universal package manager for Python, and provides admission to most of the features offered past the Platform.

Python Package management

Modern Python Package Management

ActiveState provides a unified cross-platform toolchain for mod Python bundle management. It can supersede the complex and hard-to-maintain in-firm solutions built from multiple parcel managers, environment direction tools and other solutions.

By adopting the ActiveState Platform, developers tin can:

  • Increase the security of Python environments
  • Improve the transparency of your open source supply chain
  • Dramatically reduce package and environment management overhead
  • Eliminate dependency hell
  • Reduce "works on my motorcar" problems

Ultimately, developers that are willing to adopt the ActiveState Platform volition spend less time wrestling with tooling and more time focused on doing what they practise all-time: coding.

To try the ActiveState Platform for yourself, sign-up for a free account.

Recommended Reads

How to Manually Install Python Packages

Data Canvas: ActiveState Platform's Hosted Antiquity Repository

Source: https://www.activestate.com/resources/quick-reads/python-package-installation-on-windows/

Posted by: christianwhournany.blogspot.com

0 Response to "How To Install Python Package In Visual Studio"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel