Python 3.6无法安装到Linux

时间:2018-03-02 17:28:49

标签: python linux python-3.x pip linux-from-scratch

我有一个完全绝缘的boostrapped工具链+二进制文件设置(位于/ home / tools下),它能够构建我投入的所有东西。这包括Python 2.7.14,它使用简单的--prefix构建没有问题。 唯一的例外是Python 3.6.4 。我不得不编辑configure和setup.py脚本来修补一些设置为标准/ usr目录的硬编码路径(指向ncursesw的链接值得注意)。它完全编译和构建正确,除了在'make install'安装pip。安装脚本在/ tmp下创建一个pip-build- *目录,故障源似乎以此为中心。在首次创建目录时,它会显示,并使用适当的权限掩码进行制作。但是在失败之后,我可以看到它只是用户可写(甚至不可读或不可执行)。

d-w------- 4 myuser       eng      4096 Mar  1 00:56 pip-build-xh7onsny/

这是第一个创建pip-build- *目录的strace部分。

    [pid 19771] lstat("/home/myuser/.cache/pip", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
    [pid 19771] geteuid()                   = 10345
    [pid 19771] access("/home/myuser/.cache/pip", W_OK) = 0
    [pid 19771] mkdir("/tmp/pip-build-xh7onsny", 0700) = 0
    [pid 19771] lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=28672, ...}) = 0
    [pid 19771] lstat("/tmp/pip-build-xh7onsny", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
    [pid 19771] getcwd("/nfs/home/myuser/lfs/sources/Python-3.6.4"..., 1024) = 46

这是结尾的结尾,显示出错误的位置。

[pid 19771] munmap(0x2ac5506c0000, 4096) = 0
[pid 19771] stat("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", {st_mode=S_IFREG|0644, st_size=40227, ...}) = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=40227, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a58460) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "\"\"\"Utility functions for copying"..., 32768) = 32768
[pid 19771] lseek(4, 0, SEEK_CUR)       = 32768
[pid 19771] read(4, "e, extract_dir=None, format=None"..., 8192) = 7459
[pid 19771] read(4, "", 8192)           = 0
[pid 19771] close(4)                    = 0
[pid 19771] ioctl(2, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a59f40) = -1 EINVAL (Invalid argument)
[pid 19771] write(2, "Exception:\nTraceback (most recen"..., 1739Exception:
Traceback (most recent call last):
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 385, in run
    requirement_set.cleanup_files()
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/utils/build.py", line 38, in __exit__
    self.cleanup()
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/utils/build.py", line 42, in cleanup
    rmtree(self.name)
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/retrying.py", line 212, in call
    raise attempt.get()
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/six.py", line 686, in reraise
    raise value
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "/tmp/tmpojuc47gy/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 102, in rmtree
    onerror=rmtree_errorhandler)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 476, in rmtree
    onerror(os.lstat, path, sys.exc_info())
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 474, in rmtree
    fd = os.open(path, os.O_RDONLY)
PermissionError: [Errno 13] Permission denied: '/tmp/pip-build-xh7onsny'
) = 1739
[pid 19771] lstat("/tmp/tmpojuc47gy", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
[pid 19771] open("/tmp/tmpojuc47gy", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/runpy.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=11959, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "\"\"\"runpy.py - locating and runni"..., 8192) = 8192
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/runpy.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=11959, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "\"\"\"runpy.py - locating and runni"..., 8192) = 8192
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/ensurepip/__main__.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=88, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "import ensurepip\nimport sys\n\nif "..., 8192) = 88
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/ensurepip/__init__.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=6391, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "import os\nimport os.path\nimport "..., 8192) = 6391
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/ensurepip/__init__.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=6391, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "import os\nimport os.path\nimport "..., 8192) = 6391
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/tempfile.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=26635, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "\"\"\"Temporary files.\n\nThis module"..., 8192) = 8192
[pid 19771] read(4, "       continue    # try again\n "..., 8192) = 8192
[pid 19771] read(4, "\n        \"\"\"\n        Close the t"..., 8192) = 8192
[pid 19771] read(4, "emporaryFileArgs['mode']:\n      "..., 8192) = 2059
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/tempfile.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=26635, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "\"\"\"Temporary files.\n\nThis module"..., 8192) = 8192
[pid 19771] read(4, "       continue    # try again\n "..., 8192) = 8192
[pid 19771] read(4, "\n        \"\"\"\n        Close the t"..., 8192) = 8192
[pid 19771] read(4, "emporaryFileArgs['mode']:\n      "..., 8192) = 2059
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=40227, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "\"\"\"Utility functions for copying"..., 8192) = 8192
[pid 19771] read(4, "    that are used to exclude fil"..., 8192) = 8192
[pid 19771] read(4, " = os.open(path, os.O_RDONLY)\n  "..., 8192) = 8192
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=40227, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "\"\"\"Utility functions for copying"..., 8192) = 8192
[pid 19771] read(4, "    that are used to exclude fil"..., 8192) = 8192
[pid 19771] close(4)                    = 0
[pid 19771] open("/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", O_RDONLY|0x80000 /* O_??? */) = 4
[pid 19771] ioctl(4, FIOCLEX)           = 0
[pid 19771] fstat(4, {st_mode=S_IFREG|0644, st_size=40227, ...}) = 0
[pid 19771] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff38a5b0d0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] fcntl(4, 0x406 /* F_??? */, 0) = -1 EINVAL (Invalid argument)
[pid 19771] lseek(4, 0, SEEK_SET)       = 0
[pid 19771] lseek(4, 0, SEEK_CUR)       = 0
[pid 19771] read(4, "\"\"\"Utility functions for copying"..., 8192) = 8192
[pid 19771] read(4, "    that are used to exclude fil"..., 8192) = 8192
[pid 19771] close(4)                    = 0
[pid 19771] write(2, "Traceback (most recent call last"..., 1425Traceback (most recent call last):
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/tempfile.py", line 807, in __exit__
    self.cleanup()
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/tempfile.py", line 811, in cleanup
    _shutil.rmtree(self.name)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 402, in _rmtree_safe_fd
    onerror(os.listdir, path, sys.exc_info())
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 399, in _rmtree_safe_fd
    names = os.listdir(topfd)
OSError: [Errno 22] Invalid argument: '/tmp/tmpojuc47gy'
) = 1425
[pid 19771] rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x2ac548950ab0}, {0x2ac5485f8ca0, [], SA_RESTORER, 0x2ac548950ab0}, 8) = 0
[pid 19771] munmap(0x2ac54c1df000, 1257472) = 0
[pid 19771] munmap(0x2ac54f203000, 262144) = 0
[pid 19771] sigaltstack(NULL, {ss_sp=0xc877ce0, ss_flags=0, ss_size=8192}) = 0
[pid 19771] sigaltstack({ss_sp=0, ss_flags=SS_DISABLE, ss_size=0}, NULL) = 0
[pid 19771] close(3)                    = 0
[pid 19771] futex(0x2ac54b6f78ac, FUTEX_WAKE_PRIVATE, 2147483647) = 0
[pid 19771] exit_group(1)               = ?
Process 19770 resumed
Process 19771 detached
[pid 19770] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 19771
[pid 19770] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
[pid 19770] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid 19770] wait4(-1, 0x7fff47da9a04, WNOHANG, NULL) = -1 ECHILD (No child processes)
[pid 19770] rt_sigreturn(0xffffffffffffffff) = 0
[pid 19770] rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x3c31a30030}, {0x436f50, [], SA_RESTORER, 0x3c31a30030}, 8) = 0
[pid 19770] exit_group(1)               = ?
Process 16346 resumed
Process 19770 detached
[pid 16346] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 19770
[pid 16346] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid 16346] rt_sigreturn(0xffffffff)    = 19770
[pid 16346] write(2, "make: *** [Makefile:1099: instal"..., 43make: *** [Makefile:1099: install] Error 1
) = 43

这里是&#39; make install&#39;的stdout / stderr输出。处理。它来自另一次运行,因此目录略有不同。

Installing collected packages: setuptools, pip
Successfully installed pip-9.0.1 setuptools-28.8.0
Exception:
Traceback (most recent call last):
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 385, in run
    requirement_set.cleanup_files()
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/utils/build.py", line 38, in __exit__
    self.cleanup()
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/utils/build.py", line 42, in cleanup
    rmtree(self.name)
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/retrying.py", line 212, in call
    raise attempt.get()
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/six.py", line 686, in reraise
    raise value
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "/tmp/tmpkmstr4wc/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 102, in rmtree
    onerror=rmtree_errorhandler)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 476, in rmtree
    onerror(os.lstat, path, sys.exc_info())
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 474, in rmtree
    fd = os.open(path, os.O_RDONLY)
PermissionError: [Errno 13] Permission denied: '/tmp/pip-build-in_asosn'
Traceback (most recent call last):
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/tempfile.py", line 807, in __exit__
    self.cleanup()
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/tempfile.py", line 811, in cleanup
    _shutil.rmtree(self.name)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 402, in _rmtree_safe_fd
    onerror(os.listdir, path, sys.exc_info())
  File "/nfs/home/myuser/lfs/sources/Python-3.6.4/Lib/shutil.py", line 399, in _rmtree_safe_fd
    names = os.listdir(topfd)
OSError: [Errno 22] Invalid argument: '/tmp/tmpkmstr4wc'
make: *** [Makefile:1109: altinstall] Error 1

值得注意的是,它实际上确实将pip二进制文件安装到我的$ prefix / bin目录中,但是安装后续软件包(如meson)会以类似的方式失败,所以我假设P​​ython 3.6 / pip安装并没有完全成功。似乎也来自shutil.py。这是介子安装的必要条件。

write(2, "Traceback (most recent call last"..., 1805Traceback (most recent call last):
  File "/home/tools/lib/python3.6/shutil.py", line 399, in _rmtree_safe_fd
    names = os.listdir(topfd)
OSError: [Errno 22] Invalid argument: '/tmp/easy_install-0o0par1r'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 98, in <module>
    complete DSL.''')
  File "/home/tools/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/tools/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/home/tools/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/tools/lib/python3.6/site-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/home/tools/lib/python3.6/site-packages/setuptools/command/install.py", line 117, in do_egg_install
    cmd.run()
  File "/home/tools/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 410, in run
    self.easy_install(spec, not self.no_deps)
  File "/home/tools/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 669, in easy_instal
l
    rmtree(tmpdir)
  File "/home/tools/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 2227, in rmtree
    return shutil.rmtree(path, ignore_errors, onerror)
  File "/home/tools/lib/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/home/tools/lib/python3.6/shutil.py", line 402, in _rmtree_safe_fd
    onerror(os.listdir, path, sys.exc_info())
  File "/home/tools/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1677, in auto_chmod
    six.reraise(et, (ev[0], ev[1] + (" %s %s" % (func, arg))))
TypeError: 'OSError' object is not subscriptable
) = 1805
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x2b2b4caa4ab0}, {0x2b2b4c74cca0, [], SA_RESTORER, 0x2b2b4caa
4ab0}, 8) = 0

我尝试在我自己的主目录下更改/ tmp目录,并且发生相同的错误,并且在pip-build- *目录中也具有奇怪的只写权限。我非常感谢您在调试此问题并使Python 3.6.4正确安装方面的任何帮助。谢谢!

背景:我已经设置了一个单独的,自举的工具链和二进制文件,这些工具链和二进制文件完全与工作中的Linux服务器上的主机库隔离,遵循Linux From Scratch的大部分内容。它使用内核2.6.18运行旧的Red Hat / CentOS 5发行版,由于支持旧的CAD软件,因此无法更新。但是我现在有一个完全可以工作的环境,它拥有内核(2.19),GCC(7.3.0),binutils(2.30)等支持的最新Glibc。我已经得到了所有我抛出的东西正确构建,甚至是X库和gtk应用程序,都通过rpath直接引用我的库集。

这是我的配置我需要设置 ac_cv_func_utimensat = no ac_cv_func_futimens = no ,因为可能是文件系统或内核在我的系统上不支持纳秒时间戳。使用这些选项,并修补configure / setup.py文件以删除对/ usr / lib / ncursesw的引用并替换为my / home / tools / lib路径,所有内容都可以正常构建。它是在'make install&#39; pip失败的阶段。

./configure --prefix=/home/tools \
  --enable-shared \
  --with-system-expat \
  --with-system-ffi \
  --with-ensurepip=install \
  ac_cv_func_utimensat=no \
  ac_cv_func_futimens=no

1 个答案:

答案 0 :(得分:2)

我已经安装了很多Python版本,包括3.6.4到〜/ .local。 --prefix从未遇到任何问题。这是我用来(重新)编译和安装的脚本:

#! /bin/sh

prefix="$HOME"/.local

[ -f Makefile ] && make distclean
OPT="-DNDEBUG=1 -O3" LDFLAGS="-L$prefix/lib -Xlinker -R$prefix/lib" \
LD_LIBRARY_PATH="`pwd`:$prefix/lib" \
CC="${CC:-gcc}" CPPFLAGS="-DNDEBUG=1 $CPPFLAGS" CFLAGS="-O3 $CFLAGS" \
CXX="${CXX:-g++}" CXXFLAGS="-O3 $CXXFLAGS" LDFLAGS="-s $LDFLAGS" \
./configure --enable-shared --prefix="$prefix" &&
make &&
chmod -R a+rX build &&
exec make install