共计 3620 个字符,预计需要花费 10 分钟才能阅读完成。
装置对应版本python
如果零碎装置的 python
版本和我的项目所需的版本不统一,须要手动下载 python
二进制包编译装置
获取指定版本python
,网址
https://registry.npmmirror.com/binary.html?path=python/
比方当初装置 python3.6.15
版本,上面命令参数须要根据具体 python
版本而扭转
创立文件夹
$ sudo mkdir /usr/local/python3
获取对应版本的压缩包文件
$ cd /usr/local/python3 | |
$ sudo wget https://cdn.npmmirror.com/binaries/python/3.6.15/Python-3.6.15.tar.xz |
解压压缩包之后 cd
到解压文件夹,会存在一个配置文件configure
$ sudo tar -xvf Python-3.6.15.tar.xz
执行配置文件,该操作会生成 Makefile
文件
$ cd /usr/local/python3/Python-3.6.15 | |
$ sudo ./configure --enable-optimizations --prefix=/usr/local/python3 |
--enable-optimizations
容许进行优化,--prefix
指定装置目录
编译,装置
$ sudo make all | |
$ sudo make install |
上述步骤执行实现之后,/usr/local/python3/bin
会装置好对应版本的 python
和pip
可执行文件,当初创立对应的软链接
$ sudo ln -s /usr/local/python3/bin/pip3.6 /usr/bin/pip3.6 | |
$ sudo ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3.6 |
验证装置后果,能够看到 pip3.6
指向的 python
版本以及对应地位
$ pip3.6 -V | |
pip 18.1 from /usr/local/python3/lib/python3.6/site-packages/pip (python 3.6) |
留神点
因为 python
的地位是 /usr/local/python3
,所以在pip
装置实现一些库生成的二进制包的可执行文件门路地位是/usr/local/python3/bin/
比方装置实现 celery
和uwsgi
,所以执行的时候须要执行
/usr/local/python3/bin/celery
或者/usr/local/python3/bin/uwsgi
psycopg2
或者 psycopy2-binary
的pip
依赖谬误
报错Error: pg_config executable not found.
pg_config
是位于postgresql-devel
包当中- 在
Debian/Ubuntu
系当中须要装置libpq-dev
- 在
Centos/Fedora/Cygwin/Babun/Redhat
系的零碎当中须要libpq-devel
- 麒麟零碎执行
apt install libpq-dev
lxml
的 pip
依赖谬误
报错Error: Please make sure the libxml2 and libxslt development packages are installed
执行apt install libxml2 libxslt1-dev
pillow
的 pip
依赖谬误
报错如下
The headers or library files could not be found for jpeg, | |
a required dependency when compiling Pillow from source. | |
Please see the install instructions at: | |
https://pillow.readthedocs.io/en/latest/installation.html |
顺着文档上来发现有很多二进制依赖,留神到 zlib
和libjpeg
库是必要的
去查看 python pillow
的arm
架构的 Dockerfile
查看须要装置到包
目前只须要依照必要的包即可解决问题
$ apt install libjpeg8-dev zlib1g-dev
docker
拉取镜像超时
docker pull redis
报错如下
Head https://registry-1.docker.io/v2/library/redis/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fredis%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection
或者报错如下
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
则须要批改域名解析文件 /etc/resolv.conf
,间接应用vim
编辑
nameserver 8.8.8.8 | |
nameserver 8.8.4.4 |
之后重启docker
$ sudo systemctl restart docker
docker
拉取镜像报错非法 tar
头部
报错如下
failed to register layer: ApplyLayer exit status 1 stdout: stderr: archive/tar: invalid tar header
该谬误产生起因是应用 unpigz
解压缩 docker
镜像层导致的
解决方案一,挪动 unpigz
可执行文件地位使其不解压
$ mv /usr/bin/unpigz /usr/bin/unpigz.bak
解决方案二,参考 docker
官网文档,配置对应的环境变量
$ vim /usr/lib/systemd/system/docker.service | |
# 在 Service 的单元上面,减少这一行 | |
[Service] | |
Environment="MOBY_DISABLE_PIGZ=true" |
git clone
域名解析报错
报错输入Could not resolve host: gitee.com
麒麟零碎的 git
感觉压根就不反对域名解析,首先查看 gitee.com
的IP
$ nslookup github.com | |
Server: 223.5.5.5 | |
Address: 223.5.5.5#53 | |
Non-authoritative answer: | |
Name: gitee.com | |
Address: 212.64.63.190 |
查问不到的话须要显示指定 dns
地址
$ nslookup gitlab.bolean.com 8.8.8.8
最初把对应的 IP
解析写入/etc/hosts
212.64.63.190 gitee.com
git clone
的 gnutls
报错
报错输入gnutls_handshake() failed: 在 push 函数中出错
这个解决比拟麻烦,须要把 gnutls
替换为 openssl
,只能从源码构建git
解决
装置一些前置依赖
$ apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
查看零碎以后 git
版本
$ git version | |
git version 2.25.1 |
保险起见获取一个雷同版本的 git
包
获取 git
的网站地址kernel.org
,git 镜像
$ wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.25.1.tar.gz
解压编译
$ tar -zxf git-2.25.1.tar.gz | |
$ cd git-2.25.1 | |
$ make configure |
这个时候默认是应用 openssl
的(这个不分明在别的版本是否是这样的)
执行之前先执行如下命令,查看输入的提示信息当中是否有这一行
$ ./configure --help | |
... | |
--with-openssl use OpenSSL library (default is YES) | |
ARG can be prefix for openssl library and headers | |
... |
编译装置
$ ./configure --prefix=/usr/local/git | |
$ make | |
$ make install |
最初删除零碎自带的git
,创立一个软链接指向编译生成的git
$ sudo mv /usr/bin/git /usr/bin/git.back | |
$ sudo ln -s /usr/local/git/bin/git /usr/bin/git |
参考浏览
docker daemon
文档
python pillow
的 arm
架构的Dockerfile