How do I make a module that I write available? Three ways:
Put it in the right place.
For example, drop the Python module you wrote in the Dist-packages directory.
Add a lookup directory for the Interpreter
We have added our own created directory/root/python to the interpreter's lookup directory
The problem with this method is that when we reopen the interpreter, the previously added directory disappears
To add an environment variable:
You can use the export PYTHONPATH=$PYTHONPATH:~/python
Python folder in the current user directory to add to the environment variable
However, if you use this command in terminal, it is only valid in this terminal, not in the other terminal
Place this command in the. bashrc file in the current user directory, and each time a new shell is started, the commands in this file will be executed
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Make your own Python module available