Basic knowledge of deep learning (based on Tensorflow implementation)
In order to install and deploy the project code correctly, we need to configure the source folder of this project. The following are configuration schemes for different usage scenarios.
-
Using in a
*.pyscriptWe need to set the
$PYTHONPATHenvironment variable in system, suppose/pathis your parent path of foldersource(i.e./path/source), then add the new line to the end of your system file~/.bashrcor~/.zshrc:export PYTHONPATH=/path:$PYTHONPATH
Save the file and exit the text editor. Restart your terminal or run
source ~/.bashrc(orsource ~/.zshrcif you're using Zsh) to apply the changes to your current terminal session.Now, you can import and use the
sourcepackage of this project like other Python packages in any*.pyscript or in ternimal.from source.code import utils
-
Using in a
*.ipynbJupyter Notebook in Web browser -
Using in a
*.ipynbJupyter Notebook in VSCode -
General Solution
A common solution is to add the parent path to the
sourcepackage throughsys.path.appendbefore running other code whether you are writing*.pyscripts or using Jupyter Notebook.import sys sys.path.append("your parent path of source")
The disadvantage of this method is that it is temporary and must be performed every time you write a new project.