Showing posts with label virtualenv. Show all posts
Showing posts with label virtualenv. Show all posts

7.20.2017

Install Python 3.6 on MacOS


Generally followed this post

I. Install brew
1. Install Xcode from the App Store
2. Install Xcode’s separate Command Line Tools app
$ xcode-select --install
3. Install and setup homebrew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
4. Make sure brew is in PATH
$ vi ~/.bash_profile
export PATH=/usr/local/bin:$PATH
5. Source it
$ source ~/.bash_profile
6. Try brew
$ brew doctor
Your system is ready to brew.

II. Install Python
$ brew search python
$ brew install python3
$ python3 --version
Python 3.6.2
To install a python package
$ pip3 install package_name
To upgrade python
$ brew update
$ brew upgrade python3

III. Creating Virtual environments
$ mkdir sample_project
$ cd sample_project
$ python3.6 -m venv my_env
$ source my_env/bin/activate

11.03.2016

Install Python 2.7 and Python 3.5 alongside Python 2.6 on CentOS 6.5

I got mostly from this post.
Install Python 2.7 and Python 3.5 alongside Python 2.6 on CentOS 6.5

1. Prep
# yum groupinstall "Development tools"
# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

2. Compile as shared library - add /usr/local/lib on /etc/ld.so.conf
# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib
# ldconfig

3.  Install python on  /usr/local
# Python 2.7.12:
wget http://python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
tar xf Python-2.7.12.tar.xz
cd Python-2.7.12
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared 
make && make altinstall

# Python 3.5.2:
wget http://python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
tar xf Python-3.5.2.tar.xz
cd Python-3.5.2
./configure --prefix=/usr/local --enable-shared
make && make altinstall

4. Run ldconfig again
# ldconfig

5. Install python virtualenv
# yum install python-virtualenv

6. Create virtualenv for python2.7
$ mkdir project_home
$ cd project_home
$ virtualenv -p /usr/local/bin/python2.7 .venv2.7

7. Create virtualenv for python3.5
$ mkdir project_home
$ cd project_home
$ pyvenv-3.5 .venv3.5
(this seems to work even though I get an error message:
Unable to symlink '/usr/local/bin/python3.5' to '/auto/home/delacs/python_projects_on_perf_utils/test_project/.venv3.5/bin/python3.5')