Linux 无法安装python
我试图通过下载源代码在OpenSuSE Linux上手动安装Python,并运行:Linux 无法安装python,linux,python-2.7,installation,python-install,Linux,Python 2.7,Installation,Python Install,我试图通过下载源代码在OpenSuSE Linux上手动安装Python,并运行: configure--prefix=/path/to/my/dir/installed/python 及 make&&make-install (我必须这样做,因为我使用的是我所在机构提供的服务器,而我没有根访问权限) 这给了我以下警告: make:警告:检测到时钟偏移。您的生成可能不完整。 我不确定该警告是否与我将来的错误有关。(编辑:此警告现已消失) 我检查了安装日志,发现它给了我以下错误: gcc -pth
configure--prefix=/path/to/my/dir/installed/python
及
make&&make-install
(我必须这样做,因为我使用的是我所在机构提供的服务器,而我没有根访问权限)
这给了我以下警告:
make:警告:检测到时钟偏移。您的生成可能不完整。
我不确定该警告是否与我将来的错误有关。(编辑:此警告现已消失)
我检查了安装日志,发现它给了我以下错误:
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/path/to/my/dir/installed/python/include -I. -IInclude -I./Include -I/usr/local/include -I/path/to/my/dir/setup/Python-2.7.11/Include -I/path/to/my/dir/setup/Python-2.7.11 -c /path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.c -o build/temp.linux-x86_64-2.7/path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.o
/path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.c:17:19: fatal error: panel.h: No such file or directory
#include <panel.h>
^
compilation terminated.
Python build finished, but the necessary bits to build these modules were not found:
bsddb185 dl imageop
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python 2.7.13 (default, May 26 2017, 18:16:53)
[GCC 4.8.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "/etc/pythonstart", line 7, in <module>
import readline
ImportError: No module named readline
它给了我以下错误:
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/path/to/my/dir/installed/python/include -I. -IInclude -I./Include -I/usr/local/include -I/path/to/my/dir/setup/Python-2.7.11/Include -I/path/to/my/dir/setup/Python-2.7.11 -c /path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.c -o build/temp.linux-x86_64-2.7/path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.o
/path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.c:17:19: fatal error: panel.h: No such file or directory
#include <panel.h>
^
compilation terminated.
Python build finished, but the necessary bits to build these modules were not found:
bsddb185 dl imageop
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python 2.7.13 (default, May 26 2017, 18:16:53)
[GCC 4.8.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "/etc/pythonstart", line 7, in <module>
import readline
ImportError: No module named readline
现在,如果我运行python,它会给我以下错误:
ImportError: No module named site
我在Stackoverflow上搜索后一个的解决方案,但他们只是告诉我返回到取消设置$PYTHONHOME
和$PYTHONPATH
我还尝试将这两条路径重置到其他位置,但都不起作用
请注意,如果我取消设置路径并运行python,它仍然会输出前面的“找不到依赖库”错误,如果我试图找到它提供的路径:
>>>import sys
>>>sys.path
['', '/path/to/my/dir/installed/python/lib/python27.zip',
'/path/to/my/dir/installed/python/lib/python2.7',
'/path/to/my/dir/installed/python/lib/python2.7/plat-linux2',
'/path/to/my/dir/installed/python/lib/python2.7/lib-tk',
'/path/to/my/dir/installed/python/lib/python2.7/lib-old',
'/path/to/my/dir/installed/python/lib/lib-dynload',
'/path/to/my/dir/installed/python/lib/python2.7/site-packages']
运行
make distclean
或移除并替换源。在运行之前,配置运行查找-键入f | xargs touch
然后make&&make install
@Deathgrip时钟偏移错误消失了,但我仍然有importorror…服务器是否已经安装了Python?如果没有,也许你可以要求管理员安装它?大多数服务器已经有了它。或者这会有帮助@JohnZwinck是的,是的,但是我需要一些额外的库,安装需要root,因为我需要一个新版本的numpy,并且系统管理员已经安装了一个旧版本的numpy,并且必须将它们都保留在那里…实际上,没关系,我刚刚意识到Python3的numpy是旧版本,但Python2的numpy很好,我忘记了将pip覆盖到pip2,这只需要从源代码安装easy install。只要系统管理员为我们安装的其他库没有过期,这个问题现在就可以解决。