我是Pipenv的新手,我正在为我的个人项目学习它。我无法使用pipenv安装requests
模块,我也不知道为什么。
这些是导航到我刚刚克隆的工作目录之后的步骤。我用Homebrew来安装pipenv。
# Load the virtualenv
bash-3.2$ pipenv shell
Shell for UNKNOWN_VIRTUAL_ENVIRONMENT already activated.
No action taken to avoid nested environments.
运行pipenv安装
My@My-MacBook-Pro myproject (master) $ pipenv install
Installing dependencies from Pipfile.lock (c47414)…
? ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 24/24 — 00:00:02
运行使用requests
模块的Python程序。
My@My-MacBook-Pro myproject (master) $ python movie_titles.py --title Spiderman
Traceback (most recent call last):
File "movie_titles.py", line 5, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
重新安装pipenv请求
My@My-MacBook-Pro myproject (master) $ pipenv install requests
Installing requests…
Adding requests to Pipfile's [packages]…
✔ Installation Succeeded
Installing dependencies from Pipfile.lock (c47414)…
? ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 24/24 — 00:00:02
再次运行程序
My@My-MacBook-Pro myproject (master) $ python movie_titles.py --title Spiderman
Traceback (most recent call last):
File "movie_titles.py", line 5, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
My@My-MacBook-Pro myproject (master) $