coc-python
coc-python copied to clipboard
PYTHONPATH does not take effect
I searched the README and noticed that python.pythonPath
is the path to python binary, not PYTHONPATH
. So how should
I set PYTHONPATH
?
Say I have a project that uses an external package example
.
├── example
│ └── example
│ ├── external.py
│ └── __init__.py
└── project
├── .env
└── main.py
with each file containing the following content:
# main.py
from example.external import externalfunction
# try auto completion, show_documentation(), and go to definition
externalfunction()
# __init__.py
from example.external import *
# external.py
def externalfunction():
"""
Some document
"""
print(1)
I tried to set it in the python.envFile
:
export PYTHONPATH=$PYTHONPATH:../example
but this does not work for neither Jedi nor MPLS
I also tried to manually set export PYTHONPATH=$PYTHONPATH:../example
in the commandline and then launch vim,
but this only works for jedi, not for MPLS.
How should we deal with PYTHONPATH properly? Are there ways to set this in config/env files instead of manually exporting the env variable every time? How to get it working with Jedi?
@ApolloBian The examples on MS's website on the environment file does not use export
before each key-value pari. Also, can you try giving the absolute path to your example
directory instead of using ../example
?
EDIT: If I remove export
in your .env
file, linters seem to pick up PYTHONPATH
correctly.