问题
I am confused about how the packages installed through pip and conda work together.
What I do know:
- pipand- condainstall different package format. What are the implications here except that- pipcan not install the- condapackage format? (which is fine for the purpose of this question since you can always use the appropriate command to install a package; I am interested in the part that follows)
Say, package A is installed via pip; package B installed via conda in an isolated conda environment custom_env.
Now, I create a python script, which needs to use both package A and package B; I launch it inside the custom_env.
Will the python script have access to package A?
回答1:
Question: Will the python script have access to package A?
Answer:: It seems no.
..and it makes sense.
I expected conda to guarantee an isolated environment.
But I needed to test this assumption.
How I tested it:
1 - pick a package:
e.g: scipy
2 - deactivate conda:conda deactivate
3 - check if scipy is installed in pip:pip list | grep scipy
Output:scipy                                  0.13.0b1
4 - activate conda environment:conda activate
5 - check if conda see a scipy package:conda list | grep scipy
Output:  (empty)
( Double Check )
6 - you might have a pip as part of the conda environment,
let's check it too with:pip list | grep scipy (with conda environment activated).
Output:
 
( Triple Check )
7 - I also tried to:
A - import scipy without conda environment ( with pip ) -> success
B - import scipy inside conda environment -> error
来源:https://stackoverflow.com/questions/65064180/use-pip-package-inside-conda-environment