Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support virtual environment for Python #940

Open
MeteorsLiu opened this issue Jan 7, 2025 · 0 comments
Open

Support virtual environment for Python #940

MeteorsLiu opened this issue Jan 7, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@MeteorsLiu
Copy link
Contributor

LLGo uses pkg-config to look up python lib path, however, when user is in virtual environment, the pkg-config result may not be acurate.

Example:
There's multi python version in my laptop.
Main: Python 3.13
Conda: Python 3.12.

The pkg-config result:

(base) matrix % pkg-config --libs  python3-embed
-L/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.13/lib 

After i switch environment:

(llgo)  matrix % pkg-config --libs  python3-embed 
-L/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.13/lib

It remains the same.

Even though some python virtual enviroment like Conda provides PC file for pkg-config, we cannot confirm users' virtual enviroment installation path, thus, it's hard to get the real python lib path from pkg-config.

The easy solution is that using python command to get it, like that:

python -c "import os; print('-L%s' % os.path.dirname(os.path.dirname(os.__file__)));"

@xushiwei xushiwei added the enhancement New feature or request label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants