CentOS 7 configure Python language development environment

CentOS 7 configure Python language development environment#

Initial setting reference: http://blog.csdn.net/wh211212/article/details/52923673

Install Python 3.3

# install from SCLo
[ root@linuxprobe ~]# yum --enablerepo=whos-sclo-rh -y install python33
# load environment variables
[ root@linuxprobe ~]# scl enable python33 bash
[ root@linuxprobe ~]# python -V
Python 3.3.2[root@linuxprobe ~]# which python
/opt/rh/python33/root/usr/bin/python

# Set startup environment variable settings
[ root@linuxprobe ~]# vi /etc/profile.d/python33.sh
#! /bin/bash
source /opt/rh/python33/enable
export X_SCLS="`scl enable python33 'echo $X_SCLS'`"`

Install Python 3.3

# install from SCLo
[ root@linuxprobe ~]# yum --enablerepo=whos-sclo-rh -y install python34
# load environment variables
[ root@linuxprobe ~]# scl enable python34 bash
[ root@linuxprobe ~]# python -V
Python 3.4.2[root@linuxprobe ~]# which python
/opt/rh/python34/root/usr/bin/python

# Set startup environment variable settings
[ root@linuxprobe ~]# vi /etc/profile.d/python34.sh
#! /bin/bash
source /opt/rh/python34/enable
export X_SCLS="`scl enable python33 'echo $X_SCLS'`"`

Install Python 3.5

# install from SCLo
[ root@linuxprobe ~]# yum --enablerepo=whos-sclo-rh -y install python35
# load environment variables
[ root@linuxprobe ~]# scl enable python35 bash
[ root@linuxprobe ~]# python -V
Python 3.5.2[root@linuxprobe ~]# which python
/opt/rh/python35/root/usr/bin/python

# Set startup environment variable settings
[ root@linuxprobe ~]# vi /etc/profile.d/python35.sh
#! /bin/bash
source /opt/rh/python35/enable
export X_SCLS="`scl enable python33 'echo $X_SCLS'`"`

Install Django

# install from EPEL
[ root@linuxprobe ~]# yum --enablerepo=epel -y install python-virtualenv
[ wh@linuxprobe ~]$ virtualenv venv
New python executable in venv/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.[wh@linuxprobe ~]$ cd ~/venv
[ wh@linuxprobe venv]$ source bin/activate(venv)[wh@linuxprobe venv]$ pip install django
Downloading/unpacking django
 Downloading Django-1.11.tar.gz(7.9MB):7.9MB downloaded
 Running setup.py egg_info forpackage django

 no previously-included directories found matching 'django/contrib/admin/bin'
 warning: no previously-included files matching '__pycache__' found anywhere in distribution
Downloading/unpacking pytz(from django)
 Downloading pytz-2017.2.zip(502kB): 502kB downloaded
 Running setup.py egg_info forpackage pytz

Installing collected packages: django, pytz
 Running setup.py install for django

 no previously-included directories found matching 'django/contrib/admin/bin'
 warning: no previously-included files matching '__pycache__' found anywhere in distribution
 changing mode of build/scripts-2.7/django-admin.py from664 to 775
 changing mode of/home/wh/venv/bin/django-admin.py to 775
 Installing django-admin script to /home/wh/venv/bin
 Running setup.py install for pytz

Successfully installed django pytz
Cleaning up...
# the warning above is not a problem(venv)[wh@linuxprobe venv]$ django-admin --version
1.11( venv)[wh@linuxprobe venv]$ deactivate
[ wh@linuxprobe venv]$
[ wh@linuxprobe venv]$ cd ~/venv
[ wh@linuxprobe venv]$ source bin/activate(venv)[wh@linuxprobe venv]$ django-admin startproject testproject(venv)[wh@linuxprobe venv]$ cd testproject(venv)[wh@linuxprobe testproject]$ python manage.py migrate
Operations to perform:
 Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
 Applying contenttypes.0001_initial... OK
 Applying auth.0001_initial... OK
 Applying admin.0001_initial... OK
 Applying admin.0002_logentry_remove_auto_add... OK
 Applying contenttypes.0002_remove_content_type_name... OK
 Applying auth.0002_alter_permission_name_max_length... OK
 Applying auth.0003_alter_user_email_max_length... OK
 Applying auth.0004_alter_user_username_opts... OK
 Applying auth.0005_alter_user_last_login_null... OK
 Applying auth.0006_require_contenttypes_0002... OK
 Applying auth.0007_alter_validators_add_error_messages... OK
 Applying auth.0008_alter_user_username_max_length... OK
 Applying sessions.0001_initial...OK(venv)[wh@linuxprobe testproject]$  python manage.py createsuperuser
Username(leave blank to use 'wh'): wh
Email address: [email protected]
Password:Password(again):
This password is too short. It must contain at least 8 characters.  #Password settings meet the requirements
This password is entirely numeric.
Password:Password(again):
Superuser created successfully.
# Here need to be modified to the created project to modify the setting.py file
- - - > Change to: ALLOWED_HOSTS =['*']---(venv)[wh@linuxprobe testproject]$ python manage.py runserver 10.1.1.53:8888
Performing system checks...

System check identified no issues(0 silenced).
April 12,2017-14:20:32
Django version 1.11, using settings 'testproject.settings'
Starting development server at http://10.1.1.53:8888/
Quit the server with CONTROL-C.

Recommended Posts

CentOS 7 configure Python language development environment
CentOS 7 configure Java language development environment
CentOS 7 configure Ruby language development environment
CentOS 7 configure php language development environment
Configure python3 environment on centos7 and
Centos7 configure nodejs environment
CentOS 7.2 deploy Node.js development environment
ubuntu build python development environment
Centos7 deploys python3 virtual environment
CentOS + Python3.6+
Centos 7.5 python3.6
Configure Java development environment in Ubuntu20.04 LTS
Build a python development environment under Ubuntu
Some Centos Python production environment deployment commands
Centos6 install Python2.7.13
Centos7 install Python 3.6.
CentOS install Python 3.6
Python - centos6 installation
Centos7 install Python2.7
2.3 Python language foundation
Centos install Python3
Centos7 configure JDK
CentOS6.8 install python2.7
Python3 development environment to build a detailed tutorial
01 CentOS 7.6 switch system language
Centos 6.4 python 2.6 upgrade to 2.7
CentOS6.7 build LNMP environment
Build a basic environment for Java development under Centos7
Centos 6.4 python 2.6 upgrade to 2.7
Hadoop environment construction (centos7)
Ubuntu configuration development environment
Embedded Linux development environment to build and configure Ubuntu
Centos source installation Python3
lamp (centos7) installation lamp environment
python development [first article]
Ubuntu development environment configuration
Centos6.9 install npm environment
Configure lamp under centos6.8
Centos7 configure IP address
Ubuntu18.10 configure Java environment
CentOS Python Java installations
CentOS 7 build LNMP environment
Centos default python2.6 upgrade to
[CentOS environment deployment] Java7/Java8 deployment under CentOS
Python introduction and environment installation
Build docker environment under Centos6.5
CentOS upgrade python2 to pyth
centos7 install python3 and ipython
CentOS 7 install JAVA environment (JDK 1.8)
Is python an interpreted language?
Install python environment under Linux
SkyWalking study notes (CentOS environment)
ubuntu sets python2.5 environment variables
Centos7 set up GitBook environment
CentOS install nginx+tomcat+java+mysql operating environment
Is python an interpreted language
Configure static IP under CentOS 7
Centos 6.10 reinstall python and yum
Centos6.5 install and configure mongodb
Centos configure multiple virtual IP
Configure swap space on CentOS7