Install virtualenv for python in textmate 2

I would like to work in my virtualenv from textmate 2, but I really don't know how to specify the python mate env text that it should use.

If anyone can help, thanks.

+6
source share
4 answers

You probably need to use a shell script to activate virtualenv first and then (in virtualenv) start the textmate2 process.

Shell example:

#!/bin/sh # load the virtual env . $HOME/MY-VENV/bin/activate # run the editor /path/to/textmate " $@ " 
+3
source

If there is a project folder associated with your virtualenv, you can add a .tm_properties file that contains something like

 TM_PYTHON = "$HOME/.virtualenvs/example/bin/python" 

In fact, I can create a project template for virtualenvwrapper that does this only for all new projects.

To set it globally in TextMate 2, simply add TM_PYTHON in the Variables section of the settings. You should be able to set PYTHONPATH in the same way (for each project or the entire application).

+6
source

TM_PYTHON in the TM2 settings for environment variables defines Python to the preferred interpreter, but I have not yet figured out how to set PYTHONPATH for TM2.

0
source

This article essentially shows Rob McBroom and K.-Michael Aye responding in more detail.

NOTE. It seems that you should disable any bangs ( #!/usr/bin/env python in my case) for this to work.

0
source

Source: https://habr.com/ru/post/906766/


All Articles