Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
SciPy Recipes

You're reading from   SciPy Recipes A cookbook with over 110 proven recipes for performing mathematical and scientific computations

Arrow left icon
Product type Paperback
Published in Dec 2017
Publisher Packt
ISBN-13 9781788291460
Length 386 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
V Kishore Ayyadevara V Kishore Ayyadevara
Author Profile Icon V Kishore Ayyadevara
V Kishore Ayyadevara
Ruben Oliva Ramos Ruben Oliva Ramos
Author Profile Icon Ruben Oliva Ramos
Ruben Oliva Ramos
Luiz Felipe Martins Luiz Felipe Martins
Author Profile Icon Luiz Felipe Martins
Luiz Felipe Martins
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting to Know the Tools FREE CHAPTER 2. Getting Started with NumPy 3. Using Matplotlib to Create Graphs 4. Data Wrangling with pandas 5. Matrices and Linear Algebra 6. Solving Equations and Optimization 7. Constants and Special Functions 8. Calculus, Interpolation, and Differential Equations 9. Statistics and Probability 10. Advanced Computations with SciPy

Creating a virtual environment for development with conda 

This recipe demonstrates how to set up an environment that is a clone of the current Anaconda installation. One possible use of this procedure is to set up an environment when we start the development of a new project.

Getting ready

This recipe assumes that you have a working installation of Anaconda. If you don't, follow the recipe for installing Anaconda on your operating system presented previously in this chapter.

How to do it...

  1. Start by opening a Terminal window and running the following commands:
conda update conda
conda update anaconda

These commands update both conda and Anaconda to the most recent versions. This is always recommended before creating a new environment.

  1. Next, run the following line to create a new environment named myenv:
conda create --name myenv
  1. You will be asked for confirmation and conda will then create the new environment. We now need to activate the new environment. For Linux and macOS, run the following command in the terminal:
source activate myenv
  1. In Windows, run the following:
activate myenv
  1. Notice that the command line changes to reflect the active environment, as shown in the following example:
(myenv) computer:~ username
  1. To confirm that the new environment was created, we can execute the following command:
conda info --envs
  1. This command now produces the following output:
# conda environments:
#
myenv * /Users/username/anaconda/envs/myenv
root /Users/username/anaconda

Notice that the currently active environment is marked with an asterisk.

  1. We can now install packages in the active environment without interfering with the original Python distribution. For example, to install the csvkit package, we use code in the following example:
conda install csvkit
  1. When you are done working in the environment, it is necessary to deactivate it. In Linux and macOS, this is done with the following command:
source deactivate
  1. In Windows, the command to do so is the following:
deactivate
  1. If you decide you don't need the myenv environment any longer, it can be deleted with the following command:
conda remove myenv --all

Note that you cannot remove the currently active environment.

You have been reading a chapter from
SciPy Recipes
Published in: Dec 2017
Publisher: Packt
ISBN-13: 9781788291460
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image