简体   繁体   中英

Insert a specific Python global package to Conda environment

In a conda environment, I'm using a Python package that doesn't work properly when I install it locally with conda or pip. However, it works perfectly when I install it with apt package manager. Of course, I cannot import the package in conda environment because it searches in local Python paths. I tried the following command:

export PYTHONPATH=/usr/lib/python3/dist-packages:$PYTHONPATH

which it works but I don't want to insert all the global Python packages. Then I tried:

export PYTHONPATH=/usr/lib/python3/dist-packages/<specific_package_folder>:$PYTHONPATH

but unfortunately it doesn't work.

Any suggestions ?

Finally I resolved the above issue using the following command:

ln -s /usr/lib/python3/dist-packages/<specific_package_folder>* /path/to/anaconda3/envs/envName/lib/python3.6/site-packages

With this way, I managed to link a global Python package with my local Conda environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM