YouCompleteMe / Python may be bundled for built-in libraries, but not for package sites

I just installed ycm, everything looks fine, but I found a little problem. The problem is this:

import os # os is built-in library os. # ycm helps to complete members of the class. import numpy # numpy is not built-in library, where its location is site-packages. numpy. # nothing happened. ycm shows 'pattern not found' message. 

I think that would be a simple problem. But I could not find a solution. I think there is a configuration file in which I can define a “search path” for my project.

It would be appreciated if I could find a way to solve it.

Best,

Je-Hoon Song

+6
source share
2 answers

I had the same problem with the mpmath module and fixed as follows: First, I got the path the module was in:

 %python3 >>>import mpmath >>>print(mpmath.__file__) /usr/lib/python3.4/site-packages/mpmath/__init__.py 

Here I found a path for all my "installed" python3 packages:

 /usr/lib/python3.4/site-packages/ 

Then I just added this path to my PYTHONPATH environment variable:

 %export PYTHONPATH=/usr/lib/python3.4/site-packages/ 

Then, when I used vim sample.py , typing import mpmath and after using mpmath. YCM showed me all the auto-complete for the mpmath module.

Hope this helps.

+2
source

numpy is a complex library because it dynamically creates a namespace upon import, which makes it difficult to know the static code analysis tools when you write code, which names should be available. Since the names available in the numpy namespace are really known at run time, YCM probably has no useful suggestions for you.

0
source

Source: https://habr.com/ru/post/971168/


All Articles