赞
踩
安装python系统依赖,在终端输入
sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev
下载python包,并在本地编译
- sudo wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
-
- tar zxvf Python-3.8.0.tgz
-
- cd Python-3.8.0
-
- sudo ./configure --prefix=/usr/local/python3
-
- sudo make
-
- sudo make install
重新建立python3链接
- sudo ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
-
- sudo ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
在终端中测试
- python3 -V
- pip3 -V
修改 ~/.pip/pip.conf 文件, 没有则创建
配置清华源
- [global]
- timeout = 6000
- index-url = https://pypi.tuna.tsinghua.edu.cn/simple
- trusted-host = pypi.tuna.tsinghua.edu.cn
配置虚拟开发环境
- sudo python3 -m pip install --upgrade pip
-
- pip3 install virtualenv
-
- pip3 install virtualenvwrapper
创建一个文件夹用于存放虚拟环境
mkdir .virtualenvs
可以直接执行如下命令,也可以将其放入环境变量:
- export WORKON_HOME=~/.virtualenvs
- export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 # which
- export VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv
- source ~/.local/bin/virtualenvwrapper.sh
新建一个python虚拟环境
mkvirtualenv py3
激活并进入该环境
workon py3
退出当前环境
deactivate
删除环境
rmvirtualenv py3
安装系统依赖
- sudo apt-get update
- sudo apt-get install libjpeg-dev
- sudo apt-get install libatlas-base-dev
- sudo apt-get install libjpeg-dev
- sudo apt-get install libtiff5-dev
- sudo apt-get install libpng12-dev
- sudo apt-get install libqtgui4 libqt4-test
- sudo apt-get install libjasper-dev
进入py3 虚拟环境
workon py3
安装python依赖
- pip3 install numpy
-
- pip3 install opencv-python
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。