ubuntu搭建python開發環境


一、安裝Python解釋器(免)

  ubuntu系統自帶python2.7和python3.6,位於/usr/bin/,直接執行"ptyhon"運行的是python2.7,執行"python3",才能運行python3.6。可參考下面的文件屬性:

  lrwxrwxrwx 1 root root 9 4月 16 2018 python -> python2.7
  lrwxrwxrwx 1 root root 9 4月 16 2018 python2 -> python2.7
  -rwxr-xr-x 1 root root 3637096 11月 7 18:07 python2.7

  lrwxrwxrwx 1 root root 9 11月 23 04:09 python3 -> python3.6
  -rwxr-xr-x 2 root root 4526456 11月 7 18:44 python3.6

二、安裝pip3

  1、安裝

    $>sudo apt-get install python-pip3

    說明:

      若直接使用"pip install <python庫>",會安裝到python2對應的庫里(~/.local/lib/python2.7/site-packages)。

      使用"pip3 install <python庫>",才會安裝到python3對應的庫里(~/.local/lib/python3.6/site-packages)

  2、配置pip源為阿里雲的鏡像源

    $>pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/  //全局永久更換

    $>pip install <包名> -i https://mirrors.aliyun.com/pypi/simple/  /局部/臨時使用

三、安裝pycharm

  1、安裝

    下載tar包,tar開。如:pycharm-community-2019.3.3.tar.gz

    配置pycharm的Python解釋器,可選擇系統自帶的Python3.6

  2、添加快捷方式

  1、打開終端,使用nano編輯器新建pycharm.desktop

[Desktop Entry]
Version=18.0
Name=pycharm
Comment=pycharm IDE
Exec=/home/zyz/app/pycharm/bin/pycharm.sh
Icon=/home/zyz/app/pycharm/bin/pycharm.png
Terminal=false
Type=Application
Categories=Utility;Application;

 2、右鍵"屬性"->"權限"->"作為應用程序執行"。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM