Getting PyCharm for Anaconda SciPy Recognition

I need to use the SciPy libraries inside the PyCharm IDE (on a Mac OSX Lion machine). SciPy writes that the easiest installation method for Mac users is to install Anaconda (or the equivalent distribution). I used the Anaconda installer and it created the anaconda directory in my home folder, where I found the lib/python2.7/site-packages directory with the required packages. However, PyCharm is unaware of all this, and SciPy import instructions remain unresolved.

My question is how to get PyCharm to work with Anaconda?

+16
python scipy pycharm anaconda
Sep 21 '13 at 9:28
source share
1 answer

I still agree with the Python and PyCharm ecosystem, so take the following with salt, but after reading a bit , I thought I would write a detailed explanation.

During installation, Anaconda changes the default Python interpreter to ~ / anaconda / bin / python. This interpreter is configured on sys.path , which by default corresponds to the libraries in ~ / anaconda / lib. Package managers such as python pip use an interpreter that runs them to determine the path to install packages, so after installing Anaconda, all packages installed through pip or other methods will be placed somewhere inside ~ / anaconda / lib. that is, even without using something like virtualenv, each Python interpreter has its own ecosystem and works with different interpreters, install packages in different directories.

PyCharm handles all this on the Project Settings-->Project Interpreter-->Python Interpreters screen. To tell PyCharm about the Anaconda distribution, you need to add the anaconda python interpreter to the Project Interpreter-->Python Interpreters list and make it the default for the project. PyCharm will then find all the packages installed in the Anaconda interpreter ecosystem (~ / anaconda / lib) and list them under packages in the bottom pane. He will also suggest you install setup_tools and pip for this interpreter, and once you do this, you can use the install button in the bottom panel to add more packages to the Anaconda ecosystem.

After you have added the Anaconda interpreter, you can also use the virtualenv button on the toolbar in the top panel to create a virtual interface that inherits from the Anaconda interpreter environment. In this way, you can install new packages so that this does not affect the Anaconda global distribution.

+36
Sep 26 '13 at 10:03
source share



All Articles