“在Python3上不应访问此包”错误

2024-09-28 05:17:45 发布

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

我根据安装指南(https://www.phenix-online.org/documentation/install-setup-run.html)在CentOS 7系统上安装了phenix(phenix-installer-1.17.1-3660-intel-linux-2.6-x86_64-centos6)。我的系统中的原始python版本(/usr/bin/python)是2.7.5,但我安装了anaconda3,因此“whichpython”命令的输出是“~/software/build/anaconda3/bin/python”

我试图学习p9 sad教程并运行命令“phenix.run_示例p9 sad”,但它给出了以下错误信息:

Examples to be run:  p9-sad

Running PHENIX example: p9-sad  Fri Jan 17 15:04:44 CST 2020

Working directory: /home/sunyp/Documents/tutorial/PHENIX/p9-sad
Starting run now ... please wait a moment
Error processing line 1 of /home/sunyp/software/build/anaconda3/lib/python3.7/site-packages/google_auth-1.7.1-py3.6-nspkg.pth:

Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 168, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/importlib/util.py", line 14, in <module>
    from contextlib import contextmanager
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/contextlib.py", line 5, in <module>
    from collections import deque
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/collections/__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/lib/python2.7/site-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/build/../conda_base/lib/python2.7/site-packages/site.py", line 73, in <module>
    __boot()
  File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/build/../conda_base/lib/python2.7/site-packages/site.py", line 22, in __boot
    loader.load_module('site')
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 570, in <module>
    main()
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 557, in main
    known_paths = addsitepackages(known_paths)
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 349, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 207, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 178, in addpackage
    import traceback
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/traceback.py", line 3, in <module>
    import collections
  File "/home/sunyp/software/build/anaconda3/lib/python3.7/collections/__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/lib/python2.7/site-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

这是否意味着phenix需要python2而不是python3,但我的系统中有python3,所以出现了错误?如何解决这个问题?先谢谢你

问候,

孙冶坪


Tags: runinpyimportbuildhomelibline
2条回答

仅基于/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/lib/python2.7/site-packages/reprlib/__init__.py的Phenix包含Python 2.7环境

您可以尝试使用/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/bin/python或其他东西来运行代码以使用Python解释器,但很难说清楚,因为Phenix源代码是不公开的

您的环境可能包含python2.7.5的路径 检查你的PYTHONPATH

这不适用于Python3,原因很明显。要删除它,请执行以下操作:

unset PYTHONPATH

相关问题 更多 >

    热门问题