工作實戰Python運用中,時刻會有很多環境及庫的依賴,下面介紹下自己的親身體驗。
Linux:Centos 7.4版本
Python: 2.7
Python 開發環境:PyCharm
Python依賴庫:pytz、 tzlocal、 requests、 pycrypto、watchdog,pymysql
基礎開發環境:gcc,g++,boost,gtest
一,準備工作
1、Centos 7.4 的安裝流程可參考:https://blog.csdn.net/yredh_114/article/details/83820594
2、PyCharm的安裝流程可參考:https://blog.csdn.net/yredh_114/article/details/83822144
二、環境搭建
3、Python 2.7的安裝流程,linux系統已默認安裝,我們需要安裝開發環境即可,操作如下
[root@localhost /]# yum search python-devel
[root@localhost /]# yum install python-devel.x86_64
3、pip的安裝流程
首先安裝epel擴展源,再安裝python-pip,根據自己需要的版本進行安裝即可
[root@localhost /]# yum install epel-release
[root@localhost /]# yum install python2-pip.noarch
[root@localhost /]# pip install --upgrade pip
[root@localhost /]# pip install requests
4、Python依賴庫 pytz、 tzlocal、 requests、 pycrypto、watchdog,pymysql的安裝流程
[root@localhost /]# pip install pytz
[root@localhost /]# pip install tzlocal
[root@localhost /]# pip install requests
若中間出現安裝requests錯誤,請按照以下方案進行操作:
[root@localhost /]# cd /
[root@localhost /]# find * -name 'chardet*'
[root@localhost /]# rm -rf usr/lib/python2.7/site-packages/chardet-2.0.1-py2.7.egg-info
[root@localhost /]# /usr/bin/pip install requests
[root@localhost /]# pip install pycrypto
[root@localhost /]# pip install watchdog
[root@localhost /]# pip install pymysql
5、基礎開發環境
[root@localhost /] yum install gcc-c++.x86_64
[root@localhost /] yum install boost-devel.x86_64
[root@localhost /] yum install gtest
二、總結
上述都是項目中用到的,希望給大家帶來便利,後續還會持續對各種環境的搭建輸出文檔