简体   繁体   English

无法导入Arch Linux上与pacman一起安装的python软件包

[英]Can't import python package installed with pacman on Arch Linux

Whenever I try to import a python package that I installed via pacman, I get the error 每当我尝试导入通过pacman安装的python软件包时,都会收到错误消息

ModuleNotFoundError: No module named [packageName]

In the past, I have just got around this issue by installing the packages that I need via pip, which works fine. 过去,我只是通过pip安装所需的软件包来解决此问题,效果很好。 However, in this case, that is not an option 但是,在这种情况下,这不是一种选择

Here's some stuff which might be useful to know - I'm not sure which parts of this information are relevant, but anyway: 以下是一些可能有用的知识-我不确定这些信息的哪些部分是相关的,但是无论如何:

  • Running python tells me that my version is Python 3.6.4 |Anaconda, Inc. 运行python告诉我我的版本是Python 3.6.4 |Anaconda, Inc.
  • Output of which python is /home/username/miniconda3/bin/python which python输出是/home/username/miniconda3/bin/python
  • I have the line export PATH="/home/username/miniconda3/bin:$PATH" in my ~/.bashrc 我的〜/ .bashrc中有一行export PATH="/home/username/miniconda3/bin:$PATH"
  • Running import sys , print(sys.path) gives ['', '/home/username/miniconda3/bin', '/home/username/miniconda3/lib/python36.zip', '/home/username/miniconda3/lib/python3.6', '/home/username/miniconda3/lib/python3.6/lib-dynload', '/home/username/miniconda3/lib/python3.6/site-packages', '/home/username/miniconda3/lib/python3.6/site-packages/Mako-1.0.7-py3.6.egg', '/home/username/miniconda3/lib/python3.6/site-packages/IPython/extensions', '/home/username/.ipython'] 运行import sysprint(sys.path)给出['', '/home/username/miniconda3/bin', '/home/username/miniconda3/lib/python36.zip', '/home/username/miniconda3/lib/python3.6', '/home/username/miniconda3/lib/python3.6/lib-dynload', '/home/username/miniconda3/lib/python3.6/site-packages', '/home/username/miniconda3/lib/python3.6/site-packages/Mako-1.0.7-py3.6.egg', '/home/username/miniconda3/lib/python3.6/site-packages/IPython/extensions', '/home/username/.ipython']

(In case you hadn't guessed, I'm very new to Arch, and not particularly experienced with Python, so I would be grateful for any assistance) (如果您没有猜到,我对Arch还是很陌生,并且对Python没有特别的经验,所以我将不胜感激。)

Anaconda's Python interpreter is isolated from the system. Anaconda的Python解释器与系统隔离。 If you install anything system-wide, your Anaconda's Python won't be able to find it. 如果您在系统范围内安装任何工具,Anaconda的Python将无法找到它。

If you want/need to use Anaconda you have two options: 如果您想/需要使用Anaconda,则有两种选择:

  • use conda 使用conda
  • use the pip that comes with Anaconda (which very likely is the version that you are using) 使用Anaconda随附的pip (很可能是您使用的版本)

Otherwise don't use Anaconda: remove /home/username/miniconda3/bin/python from your PATH and use the system python (should be something like /usr/bin/python ). 否则请不要使用Anaconda:从PATH删除/home/username/miniconda3/bin/python并使用系统python(应该类似于/usr/bin/python )。 The system python knows where to look for packages installed with your system package manager, eg packman ) 系统python知道在哪里可以找到随系统软件包管理器安装的软件包,例如packman

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Arch mingw:使用安装了 pacman 的 python 版本 - Arch mingw: Using a python version installed with pacman 用 Anaconda 安装了一个包,无法在 Python 中导入 - Installed a package with Anaconda, can't import in Python 安装了 python package 与 pip 但不能导入说 ZEFE90A8E604A7C640E88D03A78D6 - Installed python package with pip but can't import said package 无法导入已安装的软件包 - Can't import installed package 安装包(Python PIL / Pillow)但我无法导入它 - Package (Python PIL/Pillow) installed but I can't import it jupyter notebook 的 Python3 环境下无法导入已安装的包 - Can't import the installed package in Python3 environment of jupyter notebook 我已经在pip中上传了一个Python包,然后pip安装了这个包,但是我在Python Interpreter中无法导入这个包 - I have uploaded a Python package in pip, then pip installed this package, but I can't import this package in Python Interpreter 安装的Python软件包不会导入模块 - Python installed package won't import modules 无法导入 conda 环境中安装的 package - Can't import package that is installed in conda environment Arch Linux上的python-six软件包的ImportError - ImportError for `python-six` package on Arch Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM