python & pycharm

A, Windows download and install python

  1. Go to the official website http://python.org/ Download python (2.x 0r 3.x)

  2. Installation: Select a disk is mounted directly to the next step to complete

  3. Configure environment variables:

  D:Python27;

  D:\Python27\Scripts;

  D:\Python27\Tools\driver;

  4. Verify effect: the input cmd python

  

  5. Download the python are generally pip, pip download library to use

  

 

Second, the installation pycharm

  1. D:\Program Files\JetBrains\PyCharm Community Edition 2018.3.5

  2. pycharm increase svn

  • VCS—Browse VCS Repository—Browse Subversion Repository
  • Add SVN 1.8 (1.8 if not, then it should be svn version is not enough, you need to upgrade or repair svn)
  • Add svn address
  • Detection of a selected folder, checkout Code
  • Modify the code, try to submit code 

 

Third, install python in linux

1. rpm -qa yum install yum check whether

 

 

 

 

Install python 2.7 under Linux

 

Installation depends libraries

yum -y install python-devel openssl openssl-devel gcc sqlite sqlite-devel mysql-devel libxml2-devel libxslt-devel

Python

**================================================= **

Download python 2.7.13

www.python.org

[root@server2 ~]# mkdir /software
[root@server2 ~]# cd /software/ [root@server2 software]# wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz [root@server2 software]# ll 总用量 36852 -rw-r--r-- 1 root root 17076672 12月 18 04:21 Python-2.7.13.tgz -rw-r--r-- 1 root root 20656090 1月 17 16:07 Python-3.5.3.tgz 

unzip files

[root@server2 software]# tar -zxf Python-2.7.13.tgz 

Enter the directory

[root@server2 software]# cd Python-2.7.13

Compile and install

[root@server2 Python-2.7.13]# ./configure --prefix=/usr/local/python2.7 --with-threads --enable-shared [root@server2 Python-2.7.13]# make && make altinstall 

Backup old python related commands

===> 有些版本/usr/bin/目录下不存在pip 忽略下面第一行命令即可 [root@server2 Python-2.7.13]# mv /usr/bin/pip /usr/bin/pip_old [root@server2 Python-2.7.13]# mv /usr/bin/easy_install /usr/bin/easy_install_old [root@server2 Python-2.7.13]# mv /usr/bin/python /usr/bin/python_old 

The new version of the python command to make flexible connections, quick use

[root@server2 Python-2.7.13]# ln -s /usr/local/python2.7/lib/libpython2.7.so /usr/lib [root@server2 Python-2.7.13]# ln -s /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib [root@server2 Python-2.7.13]# ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python [root@server2 Python-2.7.13]# ln -s /usr/local/python2.7/lib/libpython2.7.so /usr/lib64 [root@server2 Python-2.7.13]# ln -s /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib64 

Whether the test can be used normally python

[root@server2 ~]# python
Python 2.7.13 (default, Apr 11 2017, 11:14:36) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 

Installation pip

Download the latest version of the pip, and then install

[root@server2 Python-2.7.13]# cd /software/ [root@server2 software]# wget https://bootstrap.pypa.io/get-pip.py [root@server2 software]# python get-pip.py 

Find the location of pip

[root@server2 software]# find / -name pip
/usr/local/python2.7/bin/pip

Pip2.7 find the path to create a soft start as the system default version

[root@server2 software]# ln -s /usr/local/python2.7/bin/pip /usr/bin/pip 

Pip test is available

[root@server2 software]# pip install Pillow
Collecting Pillow Downloading Pillow-4.1.0-cp27-cp27m-manylinux1_x86_64.whl (5.7MB) 100% |████████████████████████████████| 5.7MB 129kB/s Collecting olefile (from Pillow) Downloading olefile-0.44.zip (74kB) 100% |████████████████████████████████| 81kB 541kB/s Building wheels for collected packages: olefile Running setup.py bdist_wheel for olefile ... done Stored in directory: /root/.cache/pip/wheels/20/58/49/cc7bd00345397059149a10b0259ef38b867935ea2ecff99a9b Successfully built olefile Installing collected packages: olefile, Pillow Successfully installed Pillow-4.1.0 olefile-0.44 

Install easy_install

Download the latest version of easy_install, then install

[root@server2 software]# wget https://bootstrap.pypa.io/ez_setup.py [root@server2 software]# python ez_setup.py 

Easy_install find the path, and create soft as the system default boot version

[root@server2 software]# ln -s /usr/local/python2.7/bin/easy_install /usr/bin/easy_install 

Testing is available easy_install

[root@server2 software]# easy_install beautifulsoup4
Searching for beautifulsoup4 Reading https://pypi.python.org/simple/beautifulsoup4/ Downloading https://pypi.python.org/packages/9b/a5/c6fa2d08e6c671103f9508816588e0fb9cec40444e8e72993f3d4c325936/beautifulsoup4-4.5.3.tar.gz#md5=937e0df0d699a1237646f38fd567f0c6 Best match: beautifulsoup4 4.5.3 Processing beautifulsoup4-4.5.3.tar.gz Writing /tmp/easy_install-OSpCW5/beautifulsoup4-4.5.3/setup.cfg Running beautifulsoup4-4.5.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-OSpCW5/beautifulsoup4-4.5.3/egg-dist-tmp-m3PXo5 zip_safe flag not set; analyzing archive contents... Moving beautifulsoup4-4.5.3-py2.7.egg to /usr/local/python2.7/lib/python2.7/site-packages Adding beautifulsoup4 4.5.3 to easy-install.pth file Installed /usr/local/python2.7/lib/python2.7/site-packages/beautifulsoup4-4.5.3-py2.7.egg Processing dependencies for beautifulsoup4 Finished processing dependencies for beautifulsoup4 

yum install tools only support system comes with python version, modify the configuration file so that it can be used normally

View original version python

[root@server2 software]# ll /usr/bin/python* lrwxrwxrwx 1 root root 34 4月 11 11:20 /usr/bin/python -> /usr/local/python2.7/bin/python2.7 lrwxrwxrwx 1 root root 6 2月 15 14:33 /usr/bin/python2 -> python -rwxr-xr-x 2 root root 9032 8月 18 2016 /usr/bin/python2.6 ==> 这个就是系统自带的python -rwxr-xr-x 1 root root 1418 8月 18 2016 /usr/bin/python2.6-config lrwxrwxrwx 1 root root 16 4月 11 10:47 /usr/bin/python-config -> python2.6-config -rwxr-xr-x 2 root root 9032 8月 18 2016 /usr/bin/python_old 

Modify the configuration file / usr / bin / yum

#!/usr/bin/python  ===> 修改为 #!/usr/bin/python2.6 

Testing is available yum

[root@server2 software]# yum -y install python-devel
已加载插件:fastestmirror, security
设置安装进程
Loading mirror speeds from cached hostfile
 * epel: mirrors.aliyun.com
包 python-devel-2.6.6-66.el6_8.x86_64 已安装并且是最新版本
无须任何处理

Well, it's done.
<br />

optimization

Key to write a script to install the python2.7

Because Centos 6.x system default is python2.6, if need 2.7 server environment, then each had to manually upgrade, the workload is relatively large, scripting improve efficiency. (Default python Centos 7.x version is 2.7.5 version)

Create a directory for storing python script

[root@server2 software]# mkdir /script/python/ [root@server2 software]# cd /script/python/ 

As foreign python website to download the installation package python slow down can be downloaded in advance, and install_py27.sh together, directly extract a local file to install it in the script, I have uploaded to the network disk
click on my download

He began writing scripts install_py27.sh

#!/bin/sh 
# __author__ = 'junxi'

# This script is used by fast installed python2.7 ......
# write by 2017/04/11

echo "##############start run install for python2.7 script############"
yum -y install python-devel openssl openssl-devel gcc sqlite sqlite-devel mysql-devel libxml2-devel libxslt-devel
mkdir /software
mv Python-2.7.13.tgz /software
cd /software
tar -zxf Python-2.7.13.tgz
cd Python-2.7.13/
./configure --prefix=/usr/local/python2.7 --with-threads --enable-shared
make
make altinstall
mv /usr/bin/pip /usr/bin/pip_old
mv /usr/bin/easy_install /usr/bin/easy_install_old
mv /usr/bin/python /usr/bin/python_old
ln -s /usr/local/python2.7/lib/libpython2.7.so /usr/lib
ln -s /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib
ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python
ln -s /usr/local/python2.7/lib/libpython2.7.so /usr/lib64
ln -s /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib64
cd /software
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
ln -s /usr/local/python2.7/bin/pip /usr/bin/pip
echo "############更换pip源为国内淘宝源##########"
mkdir /root/.pip/
touch /root/.pip/pip.conf
cat >> /root/.pip/pip.conf << EOF
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/ 

[install]
trusted-host=mirrors.aliyun.com
EOF

pip install Pillow
sed -i 's#\/usr/bin/python#\/usr/bin/python2.6#g' /usr/bin/yum
yum -y install python-devel
echo 'the install script is the end......'

The Python-2.7.13.tgz install_py27.sh script file and download it, and put in the same directory:
Run the following command to install

/bin/sh install_py27.sh

After the installation is complete run python View version

 

Guess you like

Origin www.cnblogs.com/DaFaYuan/p/12042130.html