The following solution is based on this discussion .

Suppose you are using a Mac. Open your Terminal and use the following codes:

julia ENV[“PYTHON”] = “/opt/anaconda3/envs/ENVNAME/bin/python3.8”
import Pkg
Pkg.build(“PyCall”)

Replace ENVNAME with the name of your virtual environment.

Then you can use PyCall. If you …