I am learning about the Python path, and worked out how to use it in powershell. I used os.environ to find that what the variable PYTHONPATH was set to. In both powershell and ubuntu, they were set to the same place. I then navigated to this folder, and created a python file called hello.py with a simple function. When I called this from powershell with
python
import hello
hello.hello()
the code ran. However, when I run in ubuntu the same code, I get ModuleNotFound error message. This confused me because when I ran echo $PYTHONPATH
it gave the same value as in powershell when I used the os.environ method. To double check I also ran the following in my ubuntu terminal
python3
import os
os.environ['PYTHONPATH']
and this also gaves the same location.
What am I doing wrong?
EDIT: output from running py --list-paths
ethanh@LAPTOP-E642IMV7:/mnt/c$ py --list-paths
/usr/bin/py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
from collections import Iterable
usage: py [-x] [-l] [-c PRE_CMD] [-C POST_CMD] [-V] [-h] [expression]
py: error: unrecognized arguments: --list-paths