从 url pip 安装包
pip install http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz
这将安装 bs4 软件包,一切正常。但是,如果我将此行添加到 requests.txt
http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz
并运行
pip install -r requirements.txt
输出,
Downloading/unpacking http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz (from -r requirements.txt (line 40))
Downloading BeautifulSoup-4.0b.tar.gz (42Kb): 42Kb downloaded
Running setup.py egg_info for package from http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz
但该包未安装。
>>> import bs4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named bs4
pip install http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz
this installs package bs4, and everything is ok. But if I add this line to requirements.txt
http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz
and run
pip install -r requirements.txt
the output is
Downloading/unpacking http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz (from -r requirements.txt (line 40))
Downloading BeautifulSoup-4.0b.tar.gz (42Kb): 42Kb downloaded
Running setup.py egg_info for package from http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz
but the package doesn't get installed.
>>> import bs4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named bs4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请注意,如果您安装了多个解释器并且 pip 使用一个解释器(例如,2.6)而您的 python shell 使用另一个解释器(例如,2.7),则可能会发生这种情况
Note that this can happen if you have more than one interpreter installed and pip is using one (e.g., 2.6) and your python shell another (e.g., 2.7)
当您使用便携式软件或多个版本的Python / IDLE时会发生这种
情况,您只能安装在默认路径中b>,否则你需要找到一种方法来专门安装在所需路径
(对我来说,当我在Windows中使用pip时cmd在pycharm中不起作用但是当使用 pycharm 中的 pip 时可以工作)
this happens when you are working with portable software or with more than one versions of Python / IDLE
what happens is that you can only install in the default path, otherwise you need to find a way to specifically install in the required path
(for me when I used pip from the windows cmd did not work in pycharm but when used pip from pycharm worked)