snipt

Ctrl+h for KB shortcuts

Bash Session

Install Virtualenv and test

1
2
3
4
5
$ sudo pip install virtualenv # Only time you might need sudo, try without first.
$ virtualenv myenv # Create the virtual environment
$ source myenv/bin/activate # Activate the virtual environment
(myenv)$ python -c "import MYPACKAGE; print MYPACKAGE"
<module 'MYPACKAGE' from '/home/tyrelsouza/code/blog/local/lib/python2.7/site-packages/MYPACKAGE/__init__.pyc'>
https://snipt.net/embed/8957c6c9d636f01014eb310fec4519e4/
https://snipt.net/raw/8957c6c9d636f01014eb310fec4519e4/
8957c6c9d636f01014eb310fec4519e4
console
Bash Session
5
2016-09-22T17:28:25
True
False
False
/api/public/snipt/72345/
install-virtualenv-and-test
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="gp">$</span> sudo pip install virtualenv <span class="c"># Only time you might need sudo, try without first.</span> </span><span id="L-2"><a name="L-2"></a><span class="gp">$</span> virtualenv myenv <span class="c"># Create the virtual environment</span> </span><span id="L-3"><a name="L-3"></a><span class="gp">$</span> <span class="nb">source </span>myenv/bin/activate <span class="c"># Activate the virtual environment</span> </span><span id="L-4"><a name="L-4"></a><span class="gp">(myenv)$</span> python -c <span class="s2">&quot;import MYPACKAGE; print MYPACKAGE&quot;</span> </span><span id="L-5"><a name="L-5"></a><span class="go">&lt;module &#39;MYPACKAGE&#39; from &#39;/home/tyrelsouza/code/blog/local/lib/python2.7/site-packages/MYPACKAGE/__init__.pyc&#39;&gt;</span> </span></pre></div> </td></tr></table>
bash, virtualenv

Text only

VirtualEnv - Installing Psycopg

1
2
3
4
5
6
If you are using virtualenv you need install psycopg2 inside the environment, something like:

pip install psycopg2 
but you need install some packages with apt before that:

sudo apt-get install python-dev postgresql-server-dev-all
https://snipt.net/embed/b002b3de5bf998ff5d7a3257ed45661b/
https://snipt.net/raw/b002b3de5bf998ff5d7a3257ed45661b/
b002b3de5bf998ff5d7a3257ed45661b
text
Text only
6
2016-09-29T18:03:38
True
False
False
/api/public/snipt/45428/
virtualenv-installing-psycopg
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>If you are using virtualenv you need install psycopg2 inside the environment, something like: </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>pip install psycopg2 </span><span id="L-4"><a name="L-4"></a>but you need install some packages with apt before that: </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>sudo apt-get install python-dev postgresql-server-dev-all </span></pre></div> </td></tr></table>
django, postgres, virtualenv

Python

fire up virtualenv

source dev-env/bin/activate
https://snipt.net/embed/33f34c4c142a122e6c335c4bca50e427/
https://snipt.net/raw/33f34c4c142a122e6c335c4bca50e427/
33f34c4c142a122e6c335c4bca50e427
python
Python
1
2016-09-30T12:25:07
True
False
False
/api/public/snipt/23780/
fire-up-virtualenv
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="n">source</span> <span class="n">dev</span><span class="o">-</span><span class="n">env</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">activate</span> </span></pre></div> </td></tr></table>
virtualenv
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.