python 3.x - Python3 Virtual Environment and PIP -


i'd play around in virtual environment that's being interpreted purely via python3.3. on system (ubuntu 13.04), there 2 ways create virtual environment.

virtualenv env 

or:

pyvenv-3.3 env 

if use old faithful, virtualenv, i'm able use expected, however, pip installs python2.7 libs rather python3.3 libs. so, calling scripts using

python3 script.py  

doesn't seem work, yet:

python script.py  

works charm. but, must using python2.7


now, if instead, use "built-in" venv python3+ (pyvenv-3.3), seems get's little whacky. correctly places python3.3 lib folder in venv, however, installing modules using pip no longer possible seems somehow reference global rather virtual environment.

so, on question:

how recommend getting working virtual environment python3.3(+) , pip installing python3.3 libs?

you might consider trying similar following:

  1. create virtual environment

    $ python3 -m venv myvenv $ source myvenv/bin/activate (myvenv)$ 
  2. install pip according official pip installation instructions. as of pip v1.5.1 no longer need manually install setuptools before installing pip.

    (myvenv)$ curl https://bootstrap.pypa.io/get-pip.py | python 
  3. deactivate reactivate virtual environment. or pip won't work correctly.

    (myvenv)$ deactivate $ source myvenv/bin/activate (myvenv)$ pip 

longer response:

yes, had similar problem. has other pythons , pips living on system , pip did not installed, non "core" virtualenv used to.

for reason venv module not install setuptools , pip.

i did above , far, good.

venv in python 3.3 not install pip itself:

common installation tools such distribute , pip work expected venvs - i.e. when venv active, install python packages venv without needing told explicitly. of course, need install them venv first.

the python 3.4 implementation of venv installs pip default.

changed in version 3.4: installs pip default

http://docs.python.org/3/library/venv.html

you can check pip which pip , pip -v. if did not deactivate/activate venv , pip -v not show correct correct pip, which pip may still show correct path.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -