简体   繁体   English

无法导入子进程python3.6

[英]Can't import subprocess python3.6

Not sure exactly what went wrong but after installing python3-devel I can no longer import subprocess. 不确定到底出了什么问题,但在安装python3-devel之后我无法再导入子进程。 As a result I can't use pip or some important scripts I have written for my workflow. 因此,我不能使用pip或我为我的工作流程编写的一些重要脚本。 Here is the error I'm getting: 这是我得到的错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/subprocess.py", line 136, in <module>
    import _posixsubprocess
ImportError: /usr/lib64/python3.6/lib-dynload/_posixsubprocess.cpython- 
36m-x86_64-linux-gnu.so: undefined symbol: _Py_set_inheritable_async_safe

I've tried reinstall python3.6, reinstalling python3-devel, and removing python3-devel. 我已经尝试重新安装python3.6,重新安装python3-devel,并删除python3-devel。

If it helps, I'm on OpenSUSE tumbleweed with a Lenovo Ideapad 720s Ryzen 7. 如果有帮助的话,我会在联想Ideapad 720s Ryzen 7上使用OpenSUSE风滚草。

Same problem here with OpenSuse Leap while trying to create a virtual environment. 尝试创建虚拟环境时,OpenSuse Leap也存在同样的问题。 I get the exact same error as you, updating the system does not fix it, neither is updating anaconda. 我得到了与你完全相同的错误,更新系统没有修复它,也没有更新anaconda。 Maybe this is related to an update of Opensuse that causes an error with subprocess? 也许这与Opensuse的更新有关,导致子进程出错?

[EDIT]: I solved this by removing and reinstalling anaconda. [编辑]:我通过删除并重新安装anaconda解决了这个问题。 You have to make sure that no file is left behind during the uninstallation (the first time did not work for me because of that). 你必须确保在卸载过程中没有遗留任何文件(因为这个原因,第一次对我不起作用)。

使用sudo zypper up更新了我系统上的所有软件,问题得以解决。

If this happens when importing or using a third-party package, simply uninstall and reinstall the third-party package in question. 如果在导入或使用第三方软件包时发生这种情况,只需卸载并重新安装相关的第三方软件包即可。 This fixed it for me. 这为我修好了。 If you don't know which third-party package is relevant, uninstall and reinstall them all. 如果您不知道哪个第三方软件包相关,请卸载并重新安装。

The problem is evidently not with subprocess or _posixsubprocess . 问题显然不在于subprocess _posixsubprocess_posixsubprocess

I had the same issue when running pipenv install . 我在运行pipenv install时遇到了同样的问题。

In order to fix it, I had to remove the existing virtual env directory, eg sudo rm -r /home/peter/.local/share/virtualenvs/mytool-INczyaXA and then run pipenv install again. 为了解决这个问题,我不得不删除现有的虚拟env目录,例如sudo rm -r /home/peter/.local/share/virtualenvs/mytool-INczyaXA ,然后再次运行pipenv install

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM