How to use local python library
Question:
I’ve written a python script that uses steampy.
To that library I cloned it to a local folder, but now I don’t know how to make my script use the local library instead of the installed one.
I’m coming from Angular where this is achievable by making a link with npm link
between the two libraries.
Also, in my local steampy all imports referring to steampy error out, for example:
from steampy.exceptions import ApiException, ...
No name ‘exceptions’ in module ‘steampy.exceptions’ pylint(no-name-in-module)
Unable to import ‘steampy.exceptions’ pylint(import-error)`
Answers:
If you are working in a virtualenv, you can just try:
pip install -e <path to the lib>
The -e
flag makes the install editable, this means that if you do changes on the steampy
repo, those will be available on the virtualenv.
Simply put the steampy folder in the same directory as your script.
steampy
main.py
I’ve written a python script that uses steampy.
To that library I cloned it to a local folder, but now I don’t know how to make my script use the local library instead of the installed one.
I’m coming from Angular where this is achievable by making a link with npm link
between the two libraries.
Also, in my local steampy all imports referring to steampy error out, for example:
from steampy.exceptions import ApiException, ...
No name ‘exceptions’ in module ‘steampy.exceptions’ pylint(no-name-in-module)
Unable to import ‘steampy.exceptions’ pylint(import-error)`
If you are working in a virtualenv, you can just try:
pip install -e <path to the lib>
The -e
flag makes the install editable, this means that if you do changes on the steampy
repo, those will be available on the virtualenv.
Simply put the steampy folder in the same directory as your script.
steampy
main.py