说明

完全是为了记录自己的操作记录,换一台新机器真是免不了要装python。记录下来,便于以后操作。

apt-get安装

1
2
3
4
5
6
7
8
apt update 

apt install software-properties-common

add-apt-repository ppa:deadsnakes/ppa

apt install python3.7

源码安装

1
2
3
4
5
6
7
8
9
sudo apt update
sudo apt install  -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz 
tar -xf Python-3.7.3.tar.xz 
cd Python-3.7.3
./configure --enable-optimizations
make 
make altinstall 

install pip

1
apt-get install python3-pip

install virutalenv

1
pip3 install virtualenv

install pipenv

1
pip install --user pipenvd
1
pipenv install tweepy python-dotenv
1
pipenv run python twitter_client.py

install jupyter

1
2
python3 -m pip install --upgrade pip
python3 -m pip install jupyter

pip basic

查看包状态

1
pip show pkgname

更新包

1
pip install  -U  pkgname  

指定源

有时候安装一些依赖包,网不好,直接超时,或者这个包就是死都下不下来的时候,可以指定国内源镜像。 pip install -i 国内镜像地址 包名

e.g. pip install -i https://mirrors.aliyun.com/pypi/simple/ numpy 这是临时指定镜像地址

清华:https://pypi.tuna.tsinghua.edu.cn/simple

阿里云:https://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

华中理工大学:https://pypi.hustunique.com/

山东理工大学:https://pypi.sdutlinux.org/

豆瓣:https://pypi.douban.com/simple/

修改配置参考:https://cloud.tencent.com/developer/article/1566247

misc

How to install Ta-Lib in python on Windows

参考

  1. Managing Multiple Versions of Python on Ubuntu
  2. https://medium.com/@itylergarrett.tag/setting-up-python-3-7-on-windows-10-a-non-developer-tutorial-e836639ca16
  3. Here’s a Quick Way to Learn About PIP in Python
  4. How to Setup a Virtual Environment with Different Python Versions (Windows)

欢迎关注

欢迎关注微信公众帐号:沉风网事(savewind)

沉风网事