4 ms·
This is has worked for me: - brew python for my global environment. - Create a virtual enviroment for each project (python -m venv). - Use pip install after
by cuchoi 7y ago
This is has worked for me:
- brew python for my global environment.
- Create a virtual enviroment for each project (python -m venv).
- Use pip install after activating it (source venv/bin/activate)
If you need to work with different versions of python replace brew python with pyenv.
- patrickserrano 7y agoThis is my setup too and if you're using VS Code, their virtual env support makes it pretty seamless[1]. [1]https://code.visualstudio.com/docs/python/environments https://code.visualstudio.com/docs/python/environments
- cuchoi 7y agoI also use VSCode for some projects. I am not completely sold, but it is better than the alternatives IMO.
- alaithea 7y agoI was surprised at how well it worked when I tried it again recently after a hiatus. Now I just wish they would get Docker-based environments working.
- punjabisingh 7y agoVSCode already has it as a feature but it's a little rough around the edges. It's called "Remote Containers". Docs: https://code.visualstudio.com/docs/remote/containers https://code.visualstudio.com/docs/remote/containers
- bredren 7y agoThis but virtualenv / virtualenvwrapper. workon [project name] and deactivate. Pycharm sees these and they work.
- cuchoi 7y agoThe biggest advantage of venv for me is that it comes with python>=3.3. The advantage of virtualenv are the extra features, but I haven't needed them so far.
- Rotareti 7y ago> replace brew python with pyenv. replace pyenv with asdf [0]. asdf is like pyenv, but it works for all major programming languages. [0] https://github.com/asdf-vm/asdf https://github.com/asdf-vm/asdf
- cometsong 7y agoScore on asdf! The fact that it can do multiple languages and environments is lovely. My current technique for that is a pseudo-wrapper script that activates each 'env' and runs associated commands with it to set it up, e.g. bash exports, $PATH, etc. Now I just need to fit asdf into my workflow.