Friday 29 December 2017

python - How to install python3 version of package via pip on Ubuntu?

itemprop="text">


I have both
python2.7 and python3.2 installed in
Ubuntu 12.04.
The symbolic link
python links to
python2.7.



When I
type:



sudo pip install
package-name


It will
default install python2 version of
package-name.



Some
package supports both python2 and
python3.
How to install
python3 version of package-name via
pip?



class="post-text" itemprop="text">
class="normal">Answer



You may
want to build a virtualenv of python3, then install packages of
python3 after activating the virtualenv. So your system won't be messed up
:)



This could be something
like:



virtualenv -p
/usr/bin/python3 py3env
source py3env/bin/activate
pip install
package-name

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...