PY科学计算

link memo

https://www.jianshu.com/p/9f6a9456ad5f
https://blog.csdn.net/qq_22022063/article/details/78979367
https://www.jianshu.com/p/68be3a7bd7b7
https://blog.csdn.net/rumswell/article/details/8927603
https://www.cnblogs.com/misswangxing/p/7903595.html
https://www.ixueshu.com/
http://wiki.jikexueyuan.com/project/start-learning-python/311.html

install pyenv and config

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
pyenv install --list
pyenv install 3.6.3
pyenv rehash
pyenv versions
pyenv local 3.6.3 # set current folder 
python --version

set python3 venv

python3 -m venv ./venv
source venv/bin/activate # use venv
deactivate # exit venv

use douban as pypi source

vi ~/.pip/pip.conf
----------
[global]
index-url=http://pypi.doubanio.com/simple

[install]
trusted-host=pypi.doubanio.com

readline and tab-complete for python interact

yum -y install ncurses-devel patch
pip install gnureadline
wget -O repl.py -P /path/to/sys https://raw.githubusercontent.com/lilydjwg/winterpy/master/pylib/cli.py
python
>>> import repl

注意: 使用pip install readline不行; gcc需要使用4.7

pandas numpy error

pip uninstall numpy
pip install numpy==1.14.5

解决matplotlib.pyplot的依赖问题(bzip2,tkinter)

yum install bzip2-devel tkinter tk-devel
pyenv install 3.6.3 # reinstall
cd /root/.pyenv/versions/3.6.3/lib/python3.6/lib-dynload
cp ~/_bz2.cpython-36m-x86_64-linux-gnu.so ./
ln -s /usr/lib64/libbz2.so.1.0.6 /usr/lib64/libbz2.so.1.0

matplotlib.pyplot display undefine

vi ~/.bash_profile
----------
export MPLBACKEND="agg"
----------
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.show()
plt.savefig('table.png')

标签: none

添加新评论