Skip to content

Commit a13e9ab

Browse files
committed
MAC_Hints.rst: Add instructions for venv and pyenv
Commit adds instruction for venv and pyenv. Closes coala/coala#3461
1 parent cf4ebcf commit a13e9ab

File tree

1 file changed

+66
-9
lines changed

1 file changed

+66
-9
lines changed

Help/MAC_Hints.rst

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
11
Coverage Installation Hints for macOS Users:
22
============================================
33

4+
venv
5+
----
6+
7+
Here we will be using ``venv``, which is part of python's standard
8+
libary since python 3.3, to create a virtualenv for development.
9+
410
1. Make sure you have installed Xcode and Homebrew.
511
---------------------------------------------------
612

7-
2. Install Python3.
8-
-------------------
13+
2. Install Python 3.
14+
--------------------
15+
16+
For coala you will need to use Python 3, so you may
17+
simply use homebrew to install Python 3, or you could also
18+
`refer to the pyenv section <#pyenv>`__ to install Python 3 while you can also
19+
maintain other python versions.
920

1021
::
1122

12-
$ brew search python # This should display python3
23+
$ brew search python # This should display Python 3
1324
$ brew install python3
1425
$ python3 --version # To check the installed version
1526

16-
3. Create Virtual Environments with pyvenv
17-
------------------------------------------
27+
3. Create Virtual Environments with venv
28+
----------------------------------------
1829

1930
::
2031

2132
# Create Virtual Env named myenv
22-
$ pyvenv myenv
33+
$ python3 -m venv myenv
2334

2435
# This will create a folder named myenv in the
2536
# current directory. To activate this environment just type
2637
$ source myenv/bin/activate
2738

28-
# You can start Python3 by typing:
39+
# You can start Python 3 by typing:
2940
$ python
3041

3142
4. Virtualenvwrapper with Python 3:
@@ -47,10 +58,10 @@ Coverage Installation Hints for macOS Users:
4758
# Activate Changes
4859
$ source ~/.bash_profile
4960

50-
# Get Python3 path (python3_pth)
61+
# Get Python 3 path (python3_pth)
5162
$ which python3
5263

53-
# Create a new virtual environment with Python3
64+
# Create a new virtual environment with Python 3
5465
$ mkvirtualenv --python=python3_path myenv
5566

5667
Finally!
@@ -60,3 +71,49 @@ Finally!
6071

6172
# Install python-coverage3 by
6273
$ easy_install coverage
74+
75+
pyenv
76+
-----
77+
78+
Here we show how to use pyenv, which is simply a python installer
79+
that allows you to install multiple python versions and switch
80+
through them. After installation, you may also want to set up
81+
a virtual environment using :code:`venv` or :code:`virtualenv`.
82+
83+
1. Install pyenv with homebrew
84+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85+
86+
::
87+
88+
$ brew update
89+
$ brew install pyenv
90+
91+
2. Installing and using python with pyenv
92+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93+
94+
To install python you simply have to
95+
do this (you don't have to install all of them) :
96+
97+
::
98+
99+
$ pyenv install 3.5.0
100+
$ pyenv install 3.4.3
101+
$ pyenv install 3.3.6
102+
$ pyenv install 3.2.6
103+
$ pyenv install 2.7.10
104+
$ pyenv versions # lists the versions you have
105+
106+
To use a particular version you simply have to do this :
107+
108+
::
109+
110+
$ pyenv local 3.5.0
111+
112+
To know more about the available pyenv commands, please
113+
read their `Command Reference
114+
<https://github.com/pyenv/pyenv/blob/master/COMMANDS.md>`__.
115+
116+
117+
Presently, while using pyenv, tests for version-file-read fail,
118+
if interested you can
119+
have a look `here <https://github.com/yyuu/pyenv/issues/623>`__.

0 commit comments

Comments
 (0)