簡體   English   中英

安裝舊版本的python

[英]Installing an older version of python

我目前使用的是帶有 Big Sur 的 Mac 版本 11.6.1。 我有最新版本的 python (3.9),但是我需要將 3.6 用於工作中的項目。 我嘗試使用 pyenv 來安裝此版本,但在使用 pyenv 時遇到了許多問題。 所以,我接下來去了https://www.python.org/downloads/release/python-3615/並下載了這個版本。 在我的終端中,我運行了以下命令。

$ cd Downloads
$ cd python-3.6.15
$ ./configure
$ make

在這里我遇到了這個錯誤。

./Modules/getpath.c:528:49: warning: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint32_t *' (aka 'unsigned int *') [-Wincompatible-pointer-types]
    else if(0 == _NSGetExecutablePath(execpath, &nsexeclength) && execpath[0] == SEP) {
                                                ^~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach-o/dyld.h:98:54: note: passing argument to parameter 'bufsize' here
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize)                 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
                                                     ^
1 warning generated.
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes   -I. -I./Include    -DPy_BUILD_CORE  -c ./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c:8210:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ret = sendfile(in, out, offset, &sbytes, &sf, flags);
              ^
./Modules/posixmodule.c:10432:5: warning: code will never be executed [-Wunreachable-code]
    Py_FatalError("abort() called from Python code didn't abort!");
    ^~~~~~~~~~~~~
1 warning and 1 error generated.
make: *** [Modules/posixmodule.o] Error 1

我正用來自 pyenv 的錯誤和現在的錯誤在這里撞牆。 我在這里的嘗試是使用 virtualenv 運行一個虛擬環境並將其指向 3.6 版本的 python,但是,如您所見,我似乎無法正確安裝 python。 任何幫助在這里將不勝感激。

由於我被問及 pyenv 的錯誤,因此我也將其包括在內。

BUILD FAILED (OS X 11.6.1 using python-build 2.2.0-5-g54889eb8)

Inspect or clean up the working tree at /var/folders/77/93y4tp5x557ff0h_3f76bh5c0000gn/T/python-build.20211104075648.30324
Results logged to /var/folders/77/93y4tp5x557ff0h_3f76bh5c0000gn/T/python-build.20211104075648.30324.log

Last 10 log lines:
checking for --with-cxx-main=<compiler>... no
checking for clang++... no
configure:

  By default, distutils will build C++ extension modules with "clang++".
  If this is not intended, then set CXX on the configure command line.
  
checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found.  Stop.

用 penv 試試這個:

# get latest pyenv version
brew unlink pyenv
brew install pyenv --HEAD
CFLAGS=-Wno-implicit-function-declaration pyenv install 3.6.15

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM