Home > Article > Backend Development > Python to build scrapy virtual environment (Windows version)
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.
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
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)
##4. Enter and exit python virtual EnvironmentC:\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
C:\Users\kernex> workon
C:\Users\kernex> workon py3scrapy
(py3scrapy ) C:\Users\kernex> deactivate
##5. Delete python virtual environment
C: \Users\kernex> rmvirtualenv py3scrapy6. 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
# 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!