• Home
  • Raw
  • Download

Lines Matching +full:python +full:- +full:version

2 .. _tut-venv:
11 Python applications will often use packages and modules that don't
13 need a specific version of a library, because the application may
15 written using an obsolete version of the library's interface.
17 This means it may not be possible for one Python installation to meet
18 the requirements of every application. If application A needs version
19 1.0 of a particular module but application B needs version 2.0, then
20 the requirements are in conflict and installing either version 1.0 or 2.0
24 self-contained directory tree that contains a Python installation for a
25 particular version of Python, plus a number of additional packages.
29 application A can have its own virtual environment with version 1.0
30 installed while application B has another virtual environment with version 2.0.
31 If application B requires a library be upgraded to version 3.0, this will
39 :mod:`venv`. :mod:`venv` will usually install the most recent version of
40 Python that you have available. If you have multiple versions of Python on your
41 system, you can select a specific Python version by running ``python3`` or
42 whichever version you want.
47 python3 -m venv tutorial-env
49 This will create the ``tutorial-env`` directory if it doesn't exist,
50 and also create directories inside it containing a copy of the Python
63 tutorial-env\Scripts\activate.bat
67 source tutorial-env/bin/activate
76 ``python`` will get you that particular version and installation of Python.
79 .. code-block:: bash
81 $ source ~/envs/tutorial-env/bin/activate
82 (tutorial-env) $ python
83 Python 3.5.1 (default, May 6 2016, 10:59:36)
88 '~/envs/tutorial-env/lib/python3.5/site-packages']
96 :program:`pip`. By default ``pip`` will install packages from the Python
97 Package Index, <https://pypi.org>. You can browse the Python
101 .. code-block:: bash
103 (tutorial-env) $ pip search astronomy
104 skyfield - Elegant astronomy for Python
105 gary - Galactic astronomy and gravitational dynamics.
106 novas - The United States Naval Observatory NOVAS astronomy library
107 astroobs - Provides astronomy ephemeris to plan telescope observations
108 PyAstronomy - A collection of astronomy related tools for Python.
112 "freeze", etc. (Consult the :ref:`installing-index` guide for
115 You can install the latest version of a package by specifying a package's name:
117 .. code-block:: bash
119 (tutorial-env) $ python -m pip install novas
121 Downloading novas-3.1.1.3.tar.gz (136kB)
124 Successfully installed novas-3.1.1.3
126 You can also install a specific version of a package by giving the
127 package name followed by ``==`` and the version number:
129 .. code-block:: bash
131 (tutorial-env) $ python -m pip install requests==2.6.0
133 Using cached requests-2.6.0-py2.py3-none-any.whl
135 Successfully installed requests-2.6.0
137 If you re-run this command, ``pip`` will notice that the requested
138 version is already installed and do nothing. You can supply a
139 different version number to get that version, or you can run ``pip
140 install --upgrade`` to upgrade the package to the latest version:
142 .. code-block:: bash
144 (tutorial-env) $ python -m pip install --upgrade requests
148 Uninstalling requests-2.6.0:
149 Successfully uninstalled requests-2.6.0
150 Successfully installed requests-2.7.0
157 .. code-block:: bash
159 (tutorial-env) $ pip show requests
160 ---
161 Metadata-Version: 2.0
163 Version: 2.7.0
164 Summary: Python HTTP for Humans.
165 Home-page: http://python-requests.org
167 Author-email: me@kennethreitz.com
169 Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages
175 .. code-block:: bash
177 (tutorial-env) $ pip list
188 .. code-block:: bash
190 (tutorial-env) $ pip freeze > requirements.txt
191 (tutorial-env) $ cat requirements.txt
196 The ``requirements.txt`` can then be committed to version control and
198 necessary packages with ``install -r``:
200 .. code-block:: bash
202 (tutorial-env) $ python -m pip install -r requirements.txt
203 Collecting novas==3.1.1.3 (from -r requirements.txt (line 1))
205 Collecting numpy==1.9.2 (from -r requirements.txt (line 2))
207 Collecting requests==2.7.0 (from -r requirements.txt (line 3))
211 Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0
213 ``pip`` has many more options. Consult the :ref:`installing-index`
215 a package and want to make it available on the Python Package Index,
216 consult the :ref:`distributing-index` guide.