Vim's omnipotent completion for python can be used normally for all module libraries that come with python, but some custom modules do not work. This is
Because the current Vim process needs to find the corresponding module and perform import and analysis to obtain the complete vocabulary, VIM does not know the path to some custom modules.
This is found here, so the completion function will become invalid. This is related to the python PATH environment variable. There are several ways to solve this problem.
1. Modify the pythonpath environment variable pythonpath = $ home/libs/python to assign the directory of the module to the variable pythonpath. Separate multiple directories with colons,
If you use Vim on a terminal, you can modify it ~ /. Bashrc file. You can modify it if gvim is used ~ /. Profile file, so that Vim is enabled by default.
Set the pythonpath variable.
2. Add and modify the python path in the vim startup settings file.Code: File repair ~ /. Vimrc Add the following line
Let $ pythonpath. = ":/home/gnolux/develop/Python/google_appengine/lib/webob"
3. Use the specific Loading Method of Python itself:
You can add a file with the. PTH extension under the. Local/lib/python2.6/Site-packages directory. Each line in the file is a Module Directory, which is automatically started when python is started.
Find all. PTH files in this directory, parse the file content, and add the directory as the module search path.
The first method is troublesome, and you need to restart the terminal if you want to take effect. The second method is acceptable for small projects that can be manually added. The third method is recommended.
In many cases, we can use commands to automatically add related directories to the PTH file, as shown below:
Find ~ /. Local/lib-type D-print> ~ /. Local/lib/python2.6/Site-packages/python_path.pth
Add all directories under the. Local/lib directory to the path. PTH file, because I have put my own modules or third-party modules under the lib directory. For details, see the help of the find command.