2018 Python Update(1)Python ENV

2018 Python Update(1)Python ENV

Have wget first
> curl -O http://ftp.gnu.org/gnu/wget/wget-1.19.tar.gz
Unzip the file and install that on Local
> ./configure --with-ssl=openssl --prefix=/Users/hluo/tool/wget-1.19
Error
configure: error: in `/Users/hluo/install/wget-1.19':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full

Solution:
> ./configure --with-ssl=openssl --prefix=/Users/hluo/tool/wget-1.19 --with-libssl-prefix=/usr/local/ssl

Exception:
configure: error: --with-ssl=openssl was given, but SSL is not available

Solution:
Install openssl first
https://www.openssl.org/source/

>curl -O https://www.openssl.org/source/openssl-1.1.0g.tar.gz
> ./config --openssldir=/usr/local/ssl
Make and Make install on this machine
> openssl version
OpenSSL 1.1.0g  2 Nov 2017

> curl -O https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
Unzip and make and make install on my local

All of these above does not work.
Install Homebrew on MAC
https://docs.brew.sh/Installation
https://brew.sh/

Install with this command
> /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
> brew --version
Homebrew 1.5.10
Homebrew/homebrew-core (git revision c040; last commit 2018-03-13)

Install wget with brew
> brew install wget

Install Pip
Download the Pip file
> wget https://bootstrap.pypa.io/get-pip.py

Install Pip on local
>  sudo python get-pip.py

Check the version
> pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)

Python ENV
http://sillycat.iteye.com/blog/2405030

Install AWS library
> sudo pip install boto3

Exception
OSError: [Errno 1] Operation not permitted: '/tmp/pip-rb223d-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

Solution:
> sudo pip install --ignore-installed six
> sudo pip install --ignore-installed boto3

It seems I need install Python 3.6 on my Local
https://gist.github.com/alyssaq/f60393545173379e0f3f
https://wsvincent.com/install-python3-mac/

> brew install python3

> python -V
Python 2.7.10

> python3 -V
Python 3.6.4

Create a virtual env
> mkdir ~/.virtualenvs

Create python3
> python3 -m venv ~/.virtualenvs/python3env

Active
> source ~/.virtualenvs/python3env/bin/activate

Exit the ENV
> deactivate

Activate and install boto3
> source ~/.virtualenvs/python3env/bin/activate
> pip --version
pip 9.0.1 from /Users/hluo/.virtualenvs/python3env/lib/python3.6/site-packages (python 3.6)
> sudo pip install boto3

Then it works pretty well.

Set up the AWS key and secret in these files
~/.aws/credentials
~/.aws/config

Verify if my AWS config works
>>> client = boto3.client('s3')
>>> obj = client.get_object(Bucket=‘xxxxxx-dev', Key = '2016-05-19-17-38-21/manifest')
>>> print(obj['LastModified'])
2016-05-19 17:47:39+00:00

Go on check serverless framework and CloudFormation

References:
https://coolestguidesontheplanet.com/install-and-configure-wget-on-os-x/
https://superuser.com/questions/895295/ssl-not-available-when-attempting-to-compile-wget-from-source
https://ionelcondor.wordpress.com/2015/12/21/how-to-install-wget-on-mac-os-x-el-capitan/
https://www.cyberciti.biz/faq/howto-install-wget-om-mac-os-x-mountain-lion-mavericks-snow-leopard/

http://sillycat.iteye.com/blog/2405030

猜你喜欢

转载自sillycat.iteye.com/blog/2413029