I am trying to setup company-jedi to autocomplete for python3. The autocomplete is working for standard python3 modules; however, it is not working for packages I installed using pip3, in this case numpy.
virtualenv package required by company-jedi has been installed using:
sudo pip3 install virtualenv
Python3 has been installed using:
brew install python3
Numpy was installed using the following command:
sudo pip3 install numpy
I have followed the instruction from this link but to no avail. If I install
pip instead of
pip3 auto-complete works; therefore, I think that jedi is still using python2 instead of python3. The command
M-x jedi:install-server does not return any errors.
The path of python3 was determined using the command
exec-path-from-shell package is used to make sure the environment variables on emacs match those in the shell. Without this package the function
M-x jedi:install-server returns an error that
virtualenv does not exist.
My question is, how can I setup jedi to use python3 for auto-completion instead of python2?
;; To get path from shell (use-package exec-path-from-shell :ensure t :config (when (memq window-system '(mac ns x)) (exec-path-from-shell-initialize))) ;; Installing company mode (use-package company :ensure t :config (add-hook 'after-init-hook 'global-company-mode)) ;; Disable the delay (setq company-idle-delay 0) (eval-after-load 'company '(progn (define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle) (define-key company-active-map (kbd "<tab>") 'company-complete-common-or-cycle) (define-key company-active-map (kbd "S-TAB") 'company-select-previous) (define-key company-active-map (kbd "<backtab>") 'company-select-previous))) (use-package company-jedi :ensure t) (defun my/python-mode-hook () (add-to-list 'company-backends 'company-jedi)) (add-hook 'python-mode-hook 'my/python-mode-hook) ;; Python (setq python-shell-interpreter "python3") (setq jedi:environment-root "jedi") ; or any other name you like (setq jedi:environment-virtualenv (append python-environment-virtualenv '("--python" "/usr/local/bin/python3")))
I am currently on MacOs version: 10.13.6