pip install package from url

2019-03-24 14:25发布

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

2条回答
爷、活的狠高调
2楼-- · 2019-03-24 14:51

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)

查看更多
我只想做你的唯一
3楼-- · 2019-03-24 15:00

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)

查看更多
登录 后发表回答