几个月前,我已经更新了msys2系统。现在,我第一次要再次使用python,但找不到许多软件包(我想这是由于升级,请参阅下面的原因)。我将在此处描述发现的顺序,为清楚起见,我将在下面发布支持代码。
我可以启动python,但是在python中找不到pandas
(例如)和许多其他软件包。/mingw64/lib/python3.7/site-packages
本质上是空的(升级到3.8时一定要清空)。
正在寻找pandas
软件包,我已经安装了它。
[我有python 3.8的pandas
,肯定是从3.7升级的。
PYTHONPATH
从3.7重定向到3.8
现在我什至无法启动python。
我如何修复python3.8,并出现以下错误?
ImportError: cannot import name 'open_code' from 'io' (unknown location)
相关:
https://github.com/tox-dev/tox/issues/1334
https://github.com/yan12125/python3-android/issues/19
TL; DR:支持代码
[pandas
找不到
$ python
Python 3.7.4 (default, Jul 11 2019, 10:29:54)
[GCC 9.1.0] on msys
Type "help", "copyright", "credits" or "license" for more information.
Reading /home/RY16205/.pythonrc
readline is in /usr/lib/python3.7/lib-dynload/readline.cpython-37m.dll
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas'
>>>
[pandas
已安装
$ pacman -Sl | grep python | grep installed
mingw64 mingw-w64-x86_64-python 3.8.2-1 [installed: 3.8.1-1]
mingw64 mingw-w64-x86_64-python-apipkg 1.5-1 [installed]
...
mingw64 mingw-w64-x86_64-python-pandas 1.0.3-1 [installed: 1.0.1-1]
...
mingw64 mingw-w64-x86_64-python2-setuptools 44.1.0-1 [installed: 42.0.2-1]
msys python 3.7.4-1 [installed]
msys python2 2.7.17-1 [installed]
[我有python 3.8的pandas
$ pacman -Ql mingw-w64-x86_64-python-pandas | head -5
mingw-w64-x86_64-python-pandas /mingw64/
mingw-w64-x86_64-python-pandas /mingw64/lib/
mingw-w64-x86_64-python-pandas /mingw64/lib/python3.8/
mingw-w64-x86_64-python-pandas /mingw64/lib/python3.8/site-packages/
mingw-w64-x86_64-python-pandas /mingw64/lib/python3.8/site-packages/pandas-1.0.1-py3.8.egg-info/
PYTHONPATH
从3.7重定向到3.8
已更改
export PYVERSION="3.7"
export PYTHONDIR2="${MINGW_HOME}/lib/python${PYVERSION}"
export PYTHONPATH="${PYTHONDIR2}:${PYTHONDIR2}/site-packages"
to
export PYVERSION="3.8"
...
甚至都无法启动python。
$ python
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Traceback (most recent call last):
File "/c/Users/ry16205/Documents/appls_mydocs/PortableApps/MSYS2Portable/App/msys32/mingw64/lib/python3.8/io.py", line 54, in <module>
ImportError: cannot import name 'open_code' from 'io' (unknown location)
Aborted (core dumped)
我有完全相同的问题。
我建立python 2.7,更改PATH变量,但仍然失败