It is possible to do programming with Python on your own computer, but first you need to install Python. The purpose of this page is to help you to install Python and different Python packages into your own computer. Even though it is possible to install Python from their homepage, we highly recommend using Anaconda which is an open source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment. In short, it makes life much easier when installing new tools to your Python.
System requirements
- 32- or 64-bit computer.
- For Miniconda—400 MB disk space.
- For Anaconda—Minimum 3 GB disk space to download and install.
- Windows, macOS or Linux.
- Python 3.4, 3.5 or 3.6.
- pycosat.
- PyYaml.
- Requests.
NOTE: You do not need administrative or root permissions to install Anaconda if you select a user-writable install location.
Install Python on Windows
Following steps have been tested to work on Windows 7 and 10 with Anaconda3 version 5.0.1
Download Anaconda installer (64 bit) for Windows.
Download and save the installer file.
Install Anaconda to your computer by double clicking the installer and install it into a directory you want (needs admin rights). Install it to all users and use default settings.
Click on Next
Now Agree the license
Select the location to save
now next and then finish
After clicking on finish
now you can see on the start menu Anaconda Installed
Note
Note : you need to set the installation location as
C:\Python
Test that the Anaconda´s package manage called
conda
works by opening a command prompt as a admin userand running command conda --version
. If the command returns a version number of conda (e.g. conda 4.3.23
) everything is working correctly.Install Python on macOS
There is now a convenient graphical installer that can be used to install Anaconda for Mac. For the IntroQG people, we recommend you install Anaconda 4.4.0 by visiting the Anaconda downloads page and clicking on the button to install the latest Python 3 version of Anaconda, as shown below.
Note
Anaconda for Mac (version 5.0.1). You can download that version using this link to the Anaconda software repository.
Installing on macOS
- Download the installer:
- Install:
- Miniconda—In your Terminal window, run:
bash Miniconda3-latest-MacOSX-x86_64.sh
- Anaconda—Double-click the
.pkg
file.
- Follow the prompts on the installer screens.If you are unsure about any setting, accept the defaults. You can change them later.
- To make the changes take effect, close and then re-open your Terminal window.
Installing in silent mode
NOTE: The following instructions are for Miniconda. For Anaconda, substitute
Anaconda
for Miniconda
in all of the commands.
To run the silent installation of Miniconda for macOS or Linux, specify the -b and -p arguments of the bash installer. The following arguments are supported:
- -b—Batch mode with no PATH modifications to
~/.bashrc
. Assumes that you agree to the license agreement. Does not edit the.bashrc
or.bash_profile
files. - -p—Installation prefix/path.
- -f—Force installation even if prefix -p already exists.
EXAMPLE:
wget http://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
NOTE: This sets the PATH only for the current session, not permanently. Trying to use conda when conda is not in your PATH causes errors such as “command not found.”
In each new bash session, before using conda, set the PATH and run the activation scripts of your conda packages by running:
source $HOME/miniconda3/bin/activate
NOTE: Replace
$HOME/miniconda3/bin/activate
with the path to the activate script in your conda installation.
To set the PATH permanently, you can add a line to your
.bashrc
file. However, this makes it possible to use conda without running the activation scripts of your conda packages, which may produce errors.
EXAMPLE:
export PATH="$HOME/miniconda3/bin:$PATH"
Updating Anaconda or Miniconda
- Open a Terminal window.
- Navigate to the
anaconda
directory. - Run
conda update conda
.
Uninstalling Anaconda or Miniconda
- Open a Terminal window.
- Remove the entire Miniconda install directory with:
rm -rf ~/miniconda
- You may also:
- OPTIONAL: Edit
~/.bash_profile
to remove the Miniconda directory from your PATH environment variable. - Remove the following hidden file and folders that may have been created in the home directory:
.condarc
file.conda
directory.continuum
directory
By running:rm -rf ~/.condarc ~/.conda ~/.continuum
Installing on Linux
- Download the installer:
- In your Terminal window, run:
- Miniconda:
bash Miniconda3-latest-Linux-x86_64.sh
- Anaconda:
bash Anaconda-latest-Linux-x86_64.sh
- Follow the prompts on the installer screens.If you are unsure about any setting, accept the defaults. You can change them later.
- To make the changes take effect, close and then re-open your Terminal window.
Using with fish shell
To use conda with fish shell, add the following line in your
fish.config
file:source (conda info --root)/etc/fish/conf.d/conda.fish
Installing in silent mode
See the instructions for installing in silent mode on macOS.
Updating Anaconda or Miniconda
- Open a Terminal window.
- Run
conda update conda
.
Uninstalling Anaconda or Miniconda
- Open a Terminal window.
- Remove the entire miniconda install directory with:
rm -rf ~/miniconda
- OPTIONAL: Edit
~/.bash_profile
to remove the Miniconda directory from your PATH environment variable. - OPTIONAL: Remove the following hidden file and folders that may have been created in the home directory:
.condarc
file.conda
directory.continuum
directory
By running:rm -rf ~/.condarc ~/.conda ~/.continuum
How to find out which conda -command to use when installing a package?
The easiest way
The first thing to try when installing a new module
X
is to run in a command prompt (as admin) following command (here we try to install a hypothetical module called X)conda install X
In most cases this approach works but sometimes you get errors like (example when installing a module called shapely):
C:\WINDOWS\system32>conda install shapely
Using Anaconda API: https://api.anaconda.org
Fetching package metadata .........
Solving package specifications: .
Error: Package missing in current win-64 channels:
- shapely
You can search for packages on anaconda.org with
anaconda search -t conda shapely
In this case conda was not able to find the shapely module from the typical channel it uses for downloading the module.
Alternative way to install packages if typical doesn’t work
If
conda install
command was not able to install the package you were interested in there is an alternative way to do it by taking advantage of different conda distribution channels that are maintained by programmers themselves. An easy way to find the right command to install a package from these alternative conda distribution channels is to Google it.
Let’s find our way to install the Shapely module by typing following query to Google:
Here, we can see that we have different pages showing how to install
Shapely
using conda package manager.
Which one of them is the correct one to use?
We need to check the operating system banners and if you find a logo of the operating system of your computer, that is the one to use! Thus, in our case the first page that Google gives does not work in Windows but the second one does, as it has Windows logo on it:
From here we can get the correct installation command for conda and it works!
You can follow these steps similarly for all of the other Python modules that you are interested to install.
No comments:
Post a Comment