python - How to use local libs in python3 -
how import local libs in python3?
setup.cfg
[install] prefix=./
requirements.txt
# cat requirements.txt docopt==0.6.2
test.py
""" usage: test.py facility-list options: -h --help show screen. """ docopt import docopt if __name__ == '__main__': print('hellow world')
shell
pip3 install -r requirements.txt python3 test.py traceback (most recent call last): file "test.py", line 8, in <module> docopt import docopt modulenotfounderror: no module named 'docopt'
why wont import work? after pip2 install have ./lib
folder in project folder.
python 3 allows use virtual environment. in fact it's built in feature nowadays.
go folder project , type in
python3 -m venv myvenv
and it'll create folder called myvenv. next step activate virtualenv following command.
source myvenv/bin/activate
you're running inside virtual environment , can pip install.
Comments
Post a Comment