作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我用 Python 2.7 安装了 Anaconda,然后安装了 Python 3.6 内核。我有很多 Python 2 包,我不想手动安装 Python 3 的所有包。有没有人写过,或者有没有人知道如何写,一个将遍历我所有 Python 2 包的 bash 脚本然后运行 pip3 install [PACKAGE NAME]?
最佳答案
在您的 Python 2 pip 中,运行 pip freeze > requirements.txt
。这会将所有已安装的软件包写入一个文本文件。
然后,使用您的 Python 3 pip(可能是 pip3
),运行 pip install -r/path/to/requirements.txt
。这将安装 requirements.txt
文件中列出的所有包。
关于python - 如何为 python 3 安装所有 python 2 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45250797/
我是一名优秀的程序员,十分优秀!