ubt14.04+py3.7.0+openssl-1.1.1-pre8+pyinstaller3.6

目的:進行py37項目二進制發(fā)布

系統(tǒng):Ubuntu14.04

python :python3.7.0(因為Ubuntu14.04最高支持到3.7.0)

openssl:openssl-1.1.1-pre8(因為python3.7.X的ssl\_ssl模塊最少需要openssl1.0.2)

1.安裝編譯環(huán)境:

sudo apt-get install zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libpcap-dev xz-utils libexpat1-dev liblzma-dev libffi-dev libc6-dev

2.安裝openssl:

下載openssl-1.1.1-pre8

地址:https://www.openssl.org/source/openssl-1.1.1-pre8.tar.gz

進入 /home/ubuntu/

解壓縮:tar -zxvf openssl-1.1.1-pre8.tar.gz 后 cd openssl-1.1.1-pre8

配置:./config --prefix=/usr/local/openssl shared zlib

編輯和安裝:make && make install

配置共享庫:echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/openssl/lib' >> ~/.bash_profile

source ~/.bash_profile

檢驗:應該有 /usr/bin/openssl對應/usr/local/openssl/bin/openssl 使用命令openssl version可檢測

3.安裝python3.7.0:

下載python3.7.0:

地址:https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

mkdir /usr/local/python3 如果存在則先刪除再創(chuàng)建

進入 /home/ubuntu/

解壓縮:tar -zxvf Python-3.7.0.tgz 后 cd Python-3.7.0

配置:./configure prefix=/usr/local/python3 --with-openssl=/usr/local/openssl --enable-shared? --enable-optimizations

編輯和安裝:make && make install

配置python3環(huán)境變量:

echo 'export PYTHON_HOME=/usr/local/python3 export PATH=$PYTHON_HOME/bin:$PATH' >> ~/.bash_profile

source ~/.bash_profile

創(chuàng)建/usr/bin/下的同步鏈接:

rm -rf /usr/bin/python3

rm -rf /usr/bin/pip3

ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3

ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3

驗證版本和ssl模塊:

python3 -V 應該出現(xiàn) 3.7.0

python3進入后 import ssl和import _ssl不會報錯

源碼安裝完python3.7后要 防止python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

cd /etc/ld.so.conf.d

vim python3.conf #添加/usr/local/python3/lib到文件中

ldconfig #執(zhí)行l(wèi)dconfig命令,使修改生效

源碼安裝完 后卸載自帶pip python3 -m pip uninstall pip;去阿里云下載pip-19.0.3.tar.gz python3 setup.py install安裝

4.pip源地址改阿里:

ubuntu14.04:vi ~/.pip/pip.conf

widnows:直接在user目錄中創(chuàng)建一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini,內(nèi)容如下:

5.pip安裝軟件

pip3 install pyinstaller 后查看版本 pyinstaller -v 應該是3.6;若pip報錯subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1?

解決方法:

find / -name lsb_release

rm -rf /usr/bin/lsb_release

使用pip3 install -r requirements.txt批量安裝

其內(nèi)容:

aiohttp_cors==0.7.0

attrs==19.1.0

altgraph==0.17

amqp==2.5.2

aiohttp==3.5.4

apply-defaults==0.1.4

async_timeout==3.0.1

billiard==3.6.3.0

celery==4.4.2

cycler==0.10.0

chardet==3.0.4

captcha==0.3

future==0.18.2

grpcio==1.26.0

grpcio-tools==1.26.0

importlib-metadata==1.5.0

jsonrpcclient==3.3.5

jsonrpcserver==4.1.2

jsonschema==3.2.0

kiwisolver==1.1.0

kombu==4.6.8

matplotlib==3.2.0rc1

numpy==1.16.4

multidict==4.5.2

opencv-python==4.1.1.26

pefile==2019.4.18

Pillow==5.4.1

protobuf==3.11.1

importlib_metadata==1.5.0

idna==2.8

pycryptodome==3.8.2

PyInstaller==3.6

PyMySQL==0.9.3

pyparsing==2.4.5

pyrsistent==0.9.4

python-dateutil==2.8.1

pytz==2019.3

redis==3.4.1

requests==2.9.2

six==1.13.0

SQLAlchemy==1.3.10

vine==1.3.0

xmltodict==0.12.0

yarl==1.3.0

zipp==3.1.0

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容