Properly configure the SciPy development environment on Mac

Guanhui
Release: 2020-06-15 18:11:47
forward
2816 people have browsed it

Properly configure the SciPy development environment on Mac

In this article, I will share details on how to set up a development environment in the right way. I will focus mainly on Mac OS.

First, go to the GitHub repository and figure out the project's dependencies. Usually, they are listed in the readme file. If they are not listed here, you can just try to install the package/library and the errors in the terminal will give you clues about the missing dependencies. I did so and discovered that I needed the Fortran compiler, Cython and NumPy.

Install dependencies:

Let’s start with Fortran:

brew install gcc
Copy after login

Now create a new folder and set up virtualenv in it:

mkdir ~/dev
cd ~/dev
python -m venv env
Copy after login

Activate virtualenv:

source env/bin/activate
Copy after login

Now install Cython and NumPy:

pip install cython
pip install numpy
Copy after login

Now clone SciPy:

git clone git@github.com:scipy/scipy.git
Copy after login

Finally install SciPy in development mode:

cd scipy
python setup.py develop
Copy after login

Normally, if you want to install a Python package using a setup.py file, use python setup.py install. This will copy the code into the site-packages directory. Afterwards, if you make any changes to the package's source code, you will need to run python setup.py install each time.

The difference between this and python setup.pydevelop is that in the latter case, Python does not copy the code into the site-packages. Whenever you import a package, it will use the code directly from that development folder. This way, if you make any changes to the package, you don't need to run python setup.py install or python setup.pydevelopment.

When you are done developing, you can safely type deactivate, which will shut down the virtualenv.

Recommended tutorial: "Python Tutorial"

The above is the detailed content of Properly configure the SciPy development environment on Mac. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template