Pip、pip3和冲突的python发行版

2024-09-27 20:15:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我在将python包PyTransit和ktransit安装到anaconda3(在Linux上)时遇到问题。似乎很多人都有类似的错误,但他们的解决方案都没有对我有效。有很多事情要做:

pip install ktransit给出:

/usr/bin/ld: /home/name/anaconda3/lib/libgfortran.a(pause.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC

/home/name/anaconda3/lib/libgfortran.a: error adding symbols: Bad value
    collect2: error: ld returned 1 exit status

我会尝试使用./configure with--enable shared,但是没有配置文件。我尝试将extra_compile_args = ["-fPIC"], extra_link_args=["-fPIC"]添加到设置.py(如https://github.com/h5py/h5py/issues/851),但这没有任何作用。在

pip install pytransit给出了不同的错误:

^{pr2}$

这就是有趣的地方。使用pip3(或sudo pip)允许ktransit成功安装,但对pytransit没有任何作用。Pip和pip3似乎绑定在不同的地方:

which pip
/home/name/anaconda3/bin/pip

 which pip3
/usr/local/bin/pip3

which python
/home/name/anaconda3/bin/python

最后,当我试图通过anaconda在jupyter笔记本中导入ktransit时,它失败了,但是当我在jupyter QtConsole中导入ktransit时,它成功了,但似乎包含了它自己,并且没有提供实际的功能。我的意思是我不能引用模块中的任何内容,并且:

Help on package ktransit:

NAME
    ktransit

PACKAGE CONTENTS
    ktransit (package)
    setup

FILE
    (built-in)

我在想,无论python的哪个版本与/usr/bin相关联,都在某种程度上困扰着我……或者我的gcc或libgfortran有什么问题?我有gcc版本4.8.5和6(gcc——版本给出了4.8.5,但是-update备选方案说只有一个版本,6)。在

谢谢你花时间读到这里。我将非常感谢任何建议或想法!在


Tags: installpipname版本whichhomebinusr

热门问题