Solve the problem that the PIE module does not exist when using jupyter notebook in the python virtual environment in PIE-Engine

01 Some discussion of non-blog issues

Check the official website tutorial for the specific environment installation process: PIE-Engine Remote Sensing and Geographic Information Cloud Service Platform (piesat.cn)

If PIE cannot be imported in the python window, then your PIE-E has not been successfully pip installed into your python. If you are sure that you have successfully installed it, there may be multiple versions of python interpreters installed (such as 2.X, 3.X), and the python interpreter you are currently opening is not the one you installed PIE; or When you installed, it was installed in the interpreter of the default environment instead of the python interpreter of the virtual environment; or you installed it in the virtual environment but actually you are currently opening the python interpreter of the default environment.

(Why do you need to use a python interpreter in a virtual environment? <I personally think it is to copy a clean python interpreter, and then facilitate the pip of various packages of PIE, so as to avoid the conflict between the version of the package installed by PIE and the package of the default environment. Subsequent code execution fails >

  • The virtual environment can create isolated python environments for different projects, avoiding conflicts between dependent packages and python versions between different projects.
  • The virtual environment allows you to install and manage the dependent packages and python versions you need without affecting the global installation of the system.
  • Virtual environments can improve the reproducibility of projects, allowing other developers to run your code in the same environment.
  • Virtual environments allow you to easily switch and use different python versions and dependencies on different platforms.

02 Solve the problem of this blog

If import pie fails in jupyter notebook output: No such module.

 Generally, you already have jupyter notebook in your default environment, so the virtual environment does not need to repeatedly install the jupyter notebook in the default environment, which leads to the fact that we cannot call the package of the virtual environment when using jupyter notebook. If you want to solve it. You can install ipykernel (generally, this module has been installed when installing pie's python development package).

If it is not installed, you can enter it after activating the virtual environment

pip install ipykernel

After activation, connect your jupyter notebook to the virtual environment:

python -m ipykernel install --user --name your_env_name
where your_env_name is changed to the name of your virtual environment.

Guess you like

Origin blog.csdn.net/m0_63001937/article/details/130003596