sublime text3裝python代碼提示補全(anaconda)

sublime text3裝python代碼提示補全(anaconda)

已有環境

win7,python3.8.1,sublime test3 build3211,自己裝好了package control,裝好的標誌是在sublime按ctrl+shift+P,會彈出輸入框,輸入pcin會有一個 package control:install package的選項
在這裏插入圖片描述
一般都在第一個。選中它,稍等會跳轉到一個新的輸入窗口
在這裏插入圖片描述
我的安裝的過程沒有翻牆,所以是自己去找的channel_v3的文件,修改配置文件的路徑。如果這個過程沒有跳轉或者沒有相應的選項或者彈窗說出問題了,那應該是還沒有裝好或者沒有配好。

插件選擇

本來看推薦是用的sublimeCodeIntel,但是試了一下沒裝成,可能也是沒有翻牆的緣故,又不想自己手動下,所以換了一個,anaconda。

安裝

在上圖窗口打anaconda,選第一個,等他下就ok了。下完裝完之後會有一個這樣的圖像
在這裏插入圖片描述這個過程倒是沒出啥子問題,一下子搞定。
package control 也可以在preference裏面打開,如果preference裏沒有package control說明你沒有裝好package control

配置

本以爲裝好了就可以直接用了,試了一下沒用,反倒是重啓sublime給我彈窗報錯了
在這裏插入圖片描述

<Anaconda.anaconda_lib.workers.local_worker.LocalWorker object at 0x7f9ce2ad9390> initial check failed because:
can not connect to /home/chenzewei/.local/share/anaconda/run/anaconda-2/anaconda.sock.tried to connect 21 times during 2 seconds
check that there is Python process executing the anaconda jsonserver.py script running in your system. If there is, check that the Unix Domain Socket file /home/username/.local/share/anaconda/run/anaconda-2/anaconda.sock
exists and that you can connect to it writing the following script in your Sublime Text 3 console: import socket;
socket.socket(socket.AF_INET,
socket.SOCK_STREAM).connect(/home/username/.local/share/anaconda/run/anaconda-2/anaconda.sock)
If anaconda works just fine after you received this error and the command above worked you can make anaconda to do not show you this error anymore setting the ‘swallow_startup_errors’ to ‘true’ in your
configuration file.

  • 這裏需要配置一下python路徑。
    1.由於插件本身無法知道Python安裝的路徑,所以需要手動設置Python主程序的位置。選擇Preferences-package Setting-Anaconda-Settings-Default。
    2,100行左右找到python_interpreter,修改成你的python路徑。
  • 再需要配置一下插件屬性。
    1,選擇Preferences-package Setting-Anaconda-Settings-Users選項,鍵入以下json數據。保存,重啓sublime即可
    {
     "python_interpreter":"D:/Anaconda/python.exe",
     "suppress_word_completions":true,
     "suppress_explicit_completions":true,
     "comlete_parameters":true,
     "swallow_startup_errors":true,//關了sublime開啓的報錯彈窗
     "anaconda_linting":false
     }
    
  • 裏面"swallow_startup_errors":true,//關了sublime開啓的報錯彈窗
  • “python_interpreter”:“D:/Anaconda/python.exe”,//這個要換成一個步驟的python路徑
  • 打開win+r的命令窗口,輸入你的python路徑,能打開python則路徑沒有問題
  • 在win裏面複製來的路徑要把反斜線改成正斜線,纔不會被識別成轉義字符

測試

  • 重啓sublime
  • 新建python文件
  • 輸入imp等待看有沒有反應
  • 裝好pandas可以這樣試試,輸入.之後等一等,我等了10秒它纔出來
    在這裏插入圖片描述
發佈了6 篇原創文章 · 獲贊 30 · 訪問量 9021
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章