0

This should be a very pedestrian question, but how do I go about making it so that everytime I write a new python library, or download one from Github, I can just do:

$ import my_module

or

$ import github_module

without any fuss?

Is there a recommended directory in which to save all my custom or downloaded modules? Just in case: I installed Python3.6 using brew install, because some Youtube video told me that this is the neatest way to do it.

Attempted solutions:

  • Appending /path/to/my_module to sys.path every time. Sort of works, but not neat.
  • Tinkering with the ./profile, or ./bash_profile. However, after I saved the session and tried to reopen my terminal again, bash wouldn't recognise any of my commands like jupyter notebook. I did an emergency undo to revert the ./profile file to its original state. Given my lack of knowledge of the Mac OS, I'm wary of messing with these files unless I really know what I'm doing.

1 Answer 1

1

I recommend using a python package manager like miniconda; then install packages with

conda install blahblah 

it saves lot of time and pain!

and git sources can be installed using pip, (which also comes with miniconda) like

pip install -e git://git.myproject.org/MyProject.git@master#egg=MyProject

look here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.