Home  >  Article  >  Backend Development  >  Python to build scrapy virtual environment (Windows version)

Python to build scrapy virtual environment (Windows version)

零到壹度
零到壹度Original
2018-04-03 14:29:041736browse


This article mainly introduces how to build a scrapy virtual environment (Windows version) in python. The editor thinks it is quite good. Now I will share it with you and give it as a reference. . Let’s follow the editor and take a look.

Windows:

1. Install python (version 2.7 or 3.5)
Official website: https://www.python.org/downloads
After downloading, install it and configure it in the environment variables

《python scrapy虚拟环境搭建(Windows篇)》

《python scrapy虚拟环境搭建(Windows篇)》

D:\Python27 is python The path
D:\Python27\Scripts\ is the pip path

2. Install virtualenv (python virtual environment creation tool)

C:\Users\kernex> pip install virtualenv

Install virtualenvwrapper (virtualenv management tool)

C:\Users \kernex> pip install virtualenvwrapper-win

3. Create a python virtual environment

C:\Users\kernex> workon ( Check the virtual environment directory)

《python scrapy虚拟环境搭建(Windows篇)》

#

C:\Users\kernex> mkvirtualenv –python=(*) py3scrapy (Use the specified python version to create a virtual environment)
Note: (*)=python= C:\Users\kernex\AppData\Local\Programs\Python\Python35-32\python.exe

《python scrapy虚拟环境搭建(Windows篇)》

##4. Enter and exit python virtual Environment

C:\Users\kernex> workon
C:\Users\kernex> workon py3scrapy
(py3scrapy ) C:\Users\kernex> deactivate

《python scrapy虚拟环境搭建(Windows篇)》##5. Delete python virtual environment

C: \Users\kernex> rmvirtualenv py3scrapy

6. Install the library & framework in the virtual environment

(py3scrapy) C:\Users\kernex> ; pip install requests

(py3scrapy) C:\Users\kernex> pip install -i https://pypi.douban.com/simple scrapy

(-i https://pypi.douban.com/simple Use domestic Douban source to speed up the installation process)

Ps: An error may be reported during installation:

error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualstudio.com/visual-cpp-build-tools

Need to install twisted http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted Download the whl file of the corresponding version of twisted (such as my Twisted-17.9.0-cp35-cp35m-win32.whl), cp is followed by the python version, win32 represents 32-bit, run the command:

(py3scrapy) C:\Users\kernex> pip install E:\DesktopTemp\Twisted-17.9.0-cp35 -cp35m-win32.whl

Reinstall scrapy:

(py3scrapy) C:\Users\kernex> pip install -i https://pypi.douban. com/simple scrapy

《python scrapy虚拟环境搭建(Windows篇)》

# Installation successful!

The above is the detailed content of Python to build scrapy virtual environment (Windows version). For more information, please follow other related articles on the PHP Chinese website!

Statement:
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