Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

VirtualBox CentOS7.7.1908 Python3.8 builds Scrapy Development Environment [Picture and text tutorial]

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Environment

VirtualBox_v6.0.14 CentOS_v7.1908 Python_v3.8.0 MongoDB_v3.2.22 pip_v19.3.1 windows Pycharm-2019.2.3 Enterprise Edition (Community Edition does not support remote connection linux development), need to activate and use the system with its own Python2.7.5 without processing, tried pyenv installation 3.8.But when installing scrapy, it kept reporting errors, and finally uninstalled pyenv and re-compiled and installed manually.

Install CentOS

In order to ensure that the virtual machine and the host can access each other and communicate normally, the configuration mode of 2 virtual network cards is adopted.

In the VirtualBox menu, set-> network, enable two virtual network cards (virtual machine enabled, figure 2 below). The connection mode of network card 1 is set to "network address translation NAT" to ensure that the virtual machine accesses the external network and host, and the connection mode of network card 2 is set to "bridge network card" to ensure that the host can access the virtual machine.

When you install CentOS7 on a VirtualBox virtual machine, it is best to configure and enable 2 network cards (CentOS system enabled) during the installation process.

The installation process is slight.

After starting the virtual machine, use # ip addr to view the network card usage and IP allocation of the CentOS system. Enp0s3 is the NAT network card information, and ip is 10.0.2.15 by default. Enp0s8 is the network card information in bridging mode, and the default assigned ip is in the same IP address range as the host machine.

If you cannot see the ip information of a network card, it may be that the system did not enable the network card during installation. You can change the ONBOOT parameter to yes in / etc/sysconfig/network-scripts/ifcfg-enp0s3 and / etc/sysconfig/network-scripts/ifcfg-enp0s8, and then restart the network service # systemctl start network.service or # service network restart.

The ssh service is available by default after the installation of the DVD image is completed. If the host uses ssh to connect to the virtual machine, you need to set the firewall to open port 22.

# firewall-cmd-zone=public-add-port=22/tcp-permanent # Firewall Open Port 22 # firewall-cmd-reload # reload Firewall configuration # firewall-cmd-zone=public-list-port # View Open Port

At this point, you can use the windows client tool SSH to remotely connect to the virtual machine to access the operation, mainly to facilitate sharing the clipboard with the host.

Configure yum domestic mirror source

For the use of Ali Yum source, please refer to the following paragraph

Download the wget tool # yum install-y wget and enter the folder where the yum source configuration file is located # cd / etc/yum.repos.d/ backup local yum source # mv CentOS-Base.repo CentOS-Base.repo_bak get Ali source # wget-O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo clean yum cache # yum clean all rebuild cache # yum makecache upgrade Linux system # yum-y update # netstat-nltp # Check whether the port is occupied # ifconfig # View common commands of ip these commands are not installed by default You can execute the following command line installation # yum install net-tools install third-party dependencies

A big pile needs to be installed here, which is collected online and added by your own practice. If you don't want to go through all the trouble, you can follow it.

# yum-y groupinstall "Development tools" # yum-y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libxml2-devel libxslt-devel libffi-devel install mongodb

Add mongodb domestic mirror source # vim / etc/yum.repos.d/mongodb.repo paste the following

[mongodb-org] name=MongoDB Repositorybaseurl= https://mirrors.tuna.tsinghua.edu.cn/mongodb/yum/el$releasever/gpgcheck=0enabled=1

Refresh the yum cache

# yum makecache

Install mongodb

# yum-y install mongodb-org modifies the mongod.conf bindIp parameter # vim / etc/mongod.conf

Restart the mongod service

# / etc/init.d/mongod restart or # systemctl restart mongod.service

View mongod version

# mongod-version

Firewall opens port 27017

# firewall-cmd-zone=public-add-port=27017/tcp-permanent# firewall-cmd-reload# firewall-cmd-zone=public-list-port

Install python3.8

Download Python3.8 source code compilation and installation

# wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz# tar-zxvf Python-3.8.0.tgz#cd Python-3.8.0.tgz

Check dependencies, generating Makefile

#. / configure-prefix='/usr/local/python3'

Compile

# make

Installation

# make install

Make soft chain

# ln-s / usr/local/python3/bin/python3 / usr/bin/python3# ln-s / usr/local/python3/bin/pip3 / usr/bin/pip3

After Python3.7,-with-ssl is not available. You can install successfully without adding-with-ssl when executing configure. If it is not successful, you can remove the following three line comments from the Python-3.8.0/Modules/Setup file.

# _ ssl _ ssl.c\ #-DUSE_SSL-I $(SSL) / include-I $(SSL) / include/openssl\ #-L$ (SSL) / lib-lssl-lcrypto install scrapy

You can modify the pip source path first. In the Pipfile file, you can change the url attribute under [source] to: url = "https://pypi.tuna.tsinghua.edu.cn/simple", or you can directly use the following command to perform the installation.

# pip3 install-- upgrade pip-I https://pypi.tuna.tsinghua.edu.cn/simple # specify the pip source update pip# pip3 install scrapy-I https://pypi.tuna.tsinghua.edu.cn/simple # of Tsinghua University install scrapy

A lot of dependent packages for scrapy will be installed next, and it will be very slow to install Twisted, so be patient. The installation is successful when you see the picture below!

After the installation, the next step is to configure the remote development environment, please refer to the

Https://www.cnblogs.com/xiao-apple36/p/8587086.html

I heard that pipenv can install Scrapy in one step.

In addition, it is recommended to use Anaconda, which can save a lot of cross-border downloads of dependent packages, python multi-version management, and Scrapy installation can be done with one click. Especially in Windows environment, it is strongly recommended. Welcome to try to communicate

Attached

CentOS7.7.1908 the mirror path of Tsinghua University

Https://mirrors.tuna.tsinghua.edu.cn/centos/7.7.1908/isos/x86_64/CentOS-7-x86_64-DVD-1908.iso oracle VirtualBox

Https://download.virtualbox.org/virtualbox/6.0.14/VirtualBox-6.0.14-133895-Win.exe

Windows Enterprise pycharm-2019.2.3

Https://download.jetbrains.com/python/pycharm-professional-2019.2.3.exe?_ga=2.181479010.470914607.1571468237-1358446455.1571468237

Summary

The above is the editor to introduce to you VirtualBox CentOS7.7.1908 Python3.8 build Scrapy development environment [picture and text tutorial], I hope to help you, if you have any questions, please leave me a message, the editor will reply you in time. Thank you very much for your support to the website! If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report