SeleniumBase/help_docs/install_python_pip_git.md

76 lines
3.5 KiB
Markdown
Raw Normal View History

2016-09-22 15:04:43 +08:00
## Installation instructions for Python, pip, brew, git, virtualenv, and virtualenvwrapper
2018-11-27 12:45:46 +08:00
### [Python 2.7 or 3.x](https://www.python.org/downloads/)
#### macOS:
Python should already come preinstalled. You can use both Python 2.7 or Python 3.6+ with SeleniumBase. If you have [Homebrew](https://brew.sh/) installed, you can use: ``brew install python3`` to install Python 3. Or you can just get everything from [https://www.python.org/downloads/](https://www.python.org/downloads/).
The official docs.python-guide.org instructions here: [Installing Python 2 on Mac OS X](https://docs.python-guide.org/starting/install/osx/) and [Installing Python 3 on Mac OS X](https://docs.python-guide.org/starting/install3/osx/#install3-osx). (NOTE: Apple has rebranded OS X as macOS but this has not been reflected in the official docs.python-guide.org instructions yet.)
#### Windows:
You can [download Python 2.7 from here](https://www.python.org/downloads/release/python-2713/) OR [download Python 3.6.6 from here](https://www.python.org/downloads/release/python-366/).
2017-03-10 12:54:05 +08:00
### [Pip](https://en.wikipedia.org/wiki/Pip_%28package_manager%29)
2016-02-17 09:35:18 +08:00
2018-03-09 08:55:18 +08:00
You might already have pip and setuptools installed, but if you don't:
On macOS / Windows / Linux, run the following command:
2016-02-17 09:35:18 +08:00
```bash
python -m ensurepip --default-pip
2017-03-10 12:54:05 +08:00
```
If your existing version of pip is old, upgrade to the latest version:
2018-02-14 05:03:36 +08:00
```bash
python -m pip install --upgrade pip setuptools
2018-02-14 05:03:36 +08:00
```
On CentOS 7 and some versions of Linux, you may need to install pip with ``yum``:
2018-03-09 08:55:18 +08:00
```bash
yum -y update
yum -y install python-pip
2018-03-09 08:55:18 +08:00
```
2018-02-14 05:03:36 +08:00
If you're having any trouble getting pip, you can [GET PIP HERE](https://pip.pypa.io/en/latest/installing/).
2017-03-10 12:54:05 +08:00
When done, make sure the location of pip is on your path, which is `$PATH` for macOS/Linux. (On Windows, it's the System Variables `Path` within System Environment Variables. Ex: Add "C:/Python27/Scripts/" to the end of the `Path` variable.)
2018-09-29 06:42:45 +08:00
You can also get pip (or fix pip) by using:
```bash
curl https://bootstrap.pypa.io/get-pip.py | python
```
(If you get SSL errors while trying to install packages with pip, see [this Stackoverflow post](https://stackoverflow.com/questions/49768770/not-able-to-install-python-packages-ssl-tlsv1-alert-protocol-version), which tells you to run the above command.)
### [Homebrew](http://brew.sh/) (macOS-ONLY) (OPTIONAL)
The Homebrew package manager allows you to install things more easily on macOS, such as Git and Chromedriver.
Here's the command line script to install Homebrew (*from [https://brew.sh/](https://brew.sh/)*):
```bash
2017-07-20 07:51:57 +08:00
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
If you haven't updated Homebrew in awhile, you probably should. Here's how:
```bash
brew update
2016-02-18 01:28:08 +08:00
```
### [Git](http://www.git-scm.com)
2018-08-21 13:57:33 +08:00
You can [download Git from here](http://git-scm.com/downloads).
2016-02-18 01:28:08 +08:00
macOS-ONLY shortcut: (This step only works if you installed Homebrew in the previous step)
2016-02-18 01:28:08 +08:00
```bash
brew install git
```
2018-08-21 13:57:33 +08:00
(You can also download the SeleniumBase repository right from GitHub and skip all the git-related commands.)
2017-04-07 05:55:30 +08:00
<a id="virtual_environment"></a>
2016-09-22 15:04:43 +08:00
### [VirtualEnv](http://virtualenv.readthedocs.org/en/latest/) and [VirtualEnvWrapper](http://virtualenvwrapper.readthedocs.org/en/latest/)
2018-08-21 13:57:33 +08:00
Virtual environments allow each your Python projects to have a unique set of packaged dependencies.
2018-08-21 13:57:33 +08:00
To learn how to create a Python virtual environment, [see this ReadMe](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md).