我需要在其他userdir中安装带有ssl的Python3。我正在使用没有root特权的Debian。我确实是在尝试自己找到解决方案,但是在花费大量时间之后,我仍然无法正确完成它。
安装ssl和python的路径是$ HOME / .local /
$ HOME始终是绝对路径,例如/ path / to / install
下面的日志
我已经尝试过的事情:
1。创建安装文件夹
cd $HOME
mkdir .local
cd .local
mkdir ssl
mkdir python
mkdir src
cd src
2。下载最新的tar版本的Python和openssl
wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz
tar xvfz Python-3.8.1.tgz
tar xvfz openssl-1.1.1d.tar.gz
3。配置,制作,安装Openssl(在$ HOME / .local / ssl中)
cd openssl-1.1.1d
./config --prefix=$HOME/.local/ssl
make && make install
4。编辑模块/设置,制作,安装Python
cd $HOME/.local/src/Python-3.8.1
cd Modules
vi Setup
模块/设置
210 SSL=$HOME/.local/ssl
211 _ssl _ssl.c \
212 -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
213 -L$(SSL)/lib -lssl -lcrypto
配置
cd $HOME/.local/src/Python-3.8.1
./configure --prefix=$Home/.local/python
日志片段
配置Python
checking for openssl/ssl.h in /usr/local/ssl... no
checking for openssl/ssl.h in /usr/lib/ssl... no
checking for openssl/ssl.h in /usr/ssl... no
checking for openssl/ssl.h in /usr/pkg... no
checking for openssl/ssl.h in /usr/local... no
checking for openssl/ssl.h in /usr... no
checking whether compiling and linking against OpenSSL works... no
Alternative Log:似乎不在正确的位置。已经尝试在配置时给出提示
./configure --prefix=$Home/.local/python --with-openssl=$HOME/.local/ssl
在配置更改时登录:
checking for openssl/ssl.h in $HOME/.local/ssl... yes
checking whether compiling and linking against OpenSSL works... yes
checking for X509_VERIFY_PARAM_set1_host in libssl... yes
checking for --with-ssl-default-suites... python
但随后引发错误
Include/internal -I. -I./Include -DPy_BUILD_CORE \
-DGITVERSION="\"`LC_ALL=C `\"" \
-DGITTAG="\"`LC_ALL=C `\"" \
-DGITBRANCH="\"`LC_ALL=C `\"" \
-o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I./Include/internal -I. -I./Include -DPy_BUILD_CORE -o Python/frozen.o Python/frozen.c
rm -f libpython3.8.a
ar rcs libpython3.8.a Modules/getbuildinfo.o Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/token.o Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/capsule.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/interpreteridobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/picklebufobject.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/context.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/hamt.o Python/import.o Python/importdl.o Python/initconfig.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/peephole.o Python/preconfig.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/_abc.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_threadmodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o
Modules/_ssl.o Modules/xxsubtype.o Python/frozen.o
gcc -pthread -L$HOME/.local/ssl/lib -L$HOME/htdocs/.local/ssl/lib -Xlinker -export-dynamic -o python Programs/python.o libpython3.8.a -lcrypt -lpthread -ldl -lutil -lm -L$HOME/.local/ssl/lib -lssl -lcrypto -lm
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
./python: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
generate-posix-vars failed
Makefile:592: recipe for target 'pybuilddir.txt' failed
make: *** [pybuilddir.txt] Error 1
猜测错误是由于以下行而发生的
./ python:加载共享库时出错:libssl.so.1.1:无法打开共享库文件:没有这样的文件或目录
有人知道libssl.so.1.1应该在哪里吗?
提前感谢。
Wip
通过将路径添加到LD_LIBRARY_PATH已解决的问题
需要的库可以在path / to / ssl / lib中找到
对于我来说,在.profiles或.bashrc中添加以下行可解决问题
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.local/ssl/lib