Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python pip安装mod_wsgi失败,可能出现unicode错误_Python_Apache_Mod Wsgi - Fatal编程技术网

python pip安装mod_wsgi失败,可能出现unicode错误

python pip安装mod_wsgi失败,可能出现unicode错误,python,apache,mod-wsgi,Python,Apache,Mod Wsgi,我正在尝试用Flask托管一个web应用程序。我有一个运行CentOS的VPS。我已经安装了Apache2.2.26 当我在虚拟环境或主Python安装中运行pip install mod_wsgi时,会出现以下错误 第一个错误在Python跟踪之前打印 /usr/bin/ld: /home5/arguably/python27/lib/python2.7/config/libpython2.7.a(abstra ct.o): relocation R_X86_64_32 against

我正在尝试用Flask托管一个web应用程序。我有一个运行CentOS的VPS。我已经安装了Apache2.2.26

当我在虚拟环境或主Python安装中运行
pip install mod_wsgi
时,会出现以下错误

第一个错误在Python跟踪之前打印

/usr/bin/ld: /home5/arguably/python27/lib/python2.7/config/libpython2.7.a(abstra     ct.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when maki     ng a shared object; recompile with -fPIC

/home5/arguably/python27/lib/python2.7/config/libpython2.7.a: could not read sym     bols: Bad value

collect2: ld returned 1 exit status

error: command 'gcc' failed with exit status 1
这个错误发生在我的主要Python安装中。那不是virtualenv所在的地方

Python错误

Traceback (most recent call last):
  File "/home/arguably/webapps/ers_2/ers2venv/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/arguably/webapps/ers_2/ers2venv/lib/python2.7/site-packages/pip/__     init__.py", line 185, in main
    return command.main(cmd_args)
  File "/home/arguably/webapps/ers_2/ers2venv/lib/python2.7/site-packages/pip/ba     secommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 43: ordinal not in range(128)

您的Python安装尚未安装共享库。这是mod_wsgi所必需的。请参阅mod_wsgi文档


从头开始重新安装Python,这一次在构建Python时使用
--启用共享
来配置它的
脚本。

这是否可能与虚拟环境有关?还是共享库属性属于主安装?这取决于在安装时如何配置创建虚拟环境的主Python安装。如果您使用的主要Python安装是从源代码自行编译的,它将不会默认安装共享库,您必须将其配置为安装共享库。@GrahamDumpleton我也面临同样的问题。有没有办法在卸载现有Python后不重新安装来安装mod_wsgi?(比如对某个文件进行更改?)您是否在询问是否可以在不重建Python以获得共享库的情况下以某种方式修复此问题?不,你不能。有关正确构建Python所需的内容的讨论,请阅读忽略其中提到的Docker,所有内容仍然相关。@GrahamDumpleton我从安装程序安装了Python,但没有遇到任何我使用--enable shared的地方。如何重新安装python以便启用共享库?
if store_log:
            log_file_fn = options.log_file
            text = '\n'.join(complete_log)
            try:
                log_file_fp = open_logfile(log_file_fn, 'w')
            except IOError:
                temp = tempfile.NamedTemporaryFile(delete=False)
                log_file_fn = temp.name
                log_file_fp = open_logfile(log_file_fn, 'w')