I have a file mysql.py
, which I use in almost all of my projects. Since I do not want to copy and paste the same file into each of these projects I wrote a module - possibly a package in the future.
How do I add a local module to my conda environment, and automatically update or watch it when I change something in mysql.py
? How to do the same for a package?
I would like to avoid to set up a local channel/repository and just reference to the folder with mysql.py
.
This highlights a key difference between conda and pip. Pip installs Python packages whereas conda installs packages which may contain software written in any language. For example, before using pip, a Python interpreter must be installed via a system package manager or by downloading and running an installer.
To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
If you install the conda build package (and you have a package, not just a script), you can install in "editable" mode:
conda develop .
(running from the directory with your script). This is very similar to the "editable" mode from pip
pip install -e .
Either approach lets you uninstall packages with either
conda develop -u .
or
pip uninstall .
If you just have a script (not a package), you can edit or set the PYTHONPATH
environment variable to include the directory with the script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With