Recently, we have been using Python for Chinese natural language processing. The IDE is PyCharm. PyCharm is indeed the first choice for Python development, but it is still lacking in scientific computing. For this reason, I have tried EnthoughtCanopy, But Canopy feels complicated and it is not convenient to manage Python extensions. Until today I found Anaconda. Anaconda is a scientific computing environment similar to Canopy, but it is more convenient to use. The built-in package manager conda is also very powerful.
First, download and install. Anaconda provides two versions: Python2.7 and Python3.4. if you need another version, you can also create one by using conda. After installation, you can see that Anaconda provides Spyder, IPython, and a command line. Next let's take a look at conda.
Enter conda list to view all Python extensions that are provided during installation. A rough look, including commonly used Numpy, Scipy, matplotlib and networkx, and network-related extensions such as beautiful-soup, requests, flask, and tornado.
The strange thing is that there is no sklearn in it, so install it first.
Conda install scikit-learn
If you want to specify a version, you can also use [package-name] = x. x to specify it.
Conda's repo extensions are not too new. if you want to update them, you may need to use PyPI or download the source code yourself. Conda and pip are well correlated. You can use conda to manage things installed using pip, which is better than Canopy. Nltk, jieba, and gensim I installed with pip.
Another requirement for this scientific computing environment is that multiple Python versions can coexist, especially the coexistence of 2. x and 3. x. This can be done through virtualenv. Anaconda is also implemented through it.
The following uses conda to create an environment named python2 with version python2.7.
Conda create-n python2 python = 2.7
In this way, the python2 directory will be created under the envs directory under the Anaconda installation directory.
To install extensions, you can:
Directly use conda install and use-n to specify the environment to which the installation is installed. here, python2 is used.
Like virtualenv, activate it first and then install it in the virtual environment.
Suddenly there is a problem, how to use the Created Environment in IDE? For IDE such as PyCharm, you can directly set the Python installation directory. What about spyder? In fact, spyder is a Python extension. you need to install a spyder in the virtual environment.
Finally, it is the main interface of spyder. The variable display window is easy to use.