简体   繁体   中英

Install packages in Anaconda and using it in Python 3

I want to install a library called "Scrapy" for Python on Windows. The developers recommend installing the package using Anaconda instead of Python3. However, will i be able to use the package in Python3 or will i need to use Anaconda for Web Scraping?

Anaconda is loved because it simplify package management and deployment in Python(and R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN)

You get to keep your environment(program dependency) organized when using Anaconda.

With Anaconda, you can use any Python version, and libraries you need for a specific task. A workflow would be as follow(Assuming you have install Anaconda, and its available on your system path):

conda create -n scrap python=3.6 
conda activate scrap
conda install -c conda-forge scrapy 

Here we create environment called scrap with python version 3.6. We then activate it and install scrapy fron a conda channel forge.

While in this environment(scrap), you have access to Python 3.6 and scrapy. The best thing about this is that this is separate from your other Python and packages.

To get out of your environment,

conda deactivate

While in your environment, you can use both conda and pip to install packages to that environment. Always try finding packages in conda(plus it's channels) before using pip, becsusr conda will check for packages compatabilities before installation. It will know which packages to upgrade or downgrade to avoid conflicts.

In few cases where a package is not in conda, then use pip. Read more: https://conda.io/docs/index.html

Anaconda is a python distribution which contains additional packages to the python it ships with. To have lightweight version of python (without many additional packages), you can install Miniconda. Anaconda and Miniconda come with the conda package manager. You can use it to install and update packages specific to its python distribution.

To install scrapy package using Anaconda / Miniconda, in the Windows Command Prompt simply type in:

conda install scrapy

Anaconda只是简化了安装,但你也可以通过PyPi安装scrapy

pip install scrapy

In Anaconda you can install almost all python packages using conda install or pip install.

You have to goto Anaconda prompt and type in pip install Scrapy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM