Sep-11-2017, 05:12 PM
Pipenv is now the official recommended Python packaging tool from Python.org.
The documentation look at this video for usage.
I did test it in a earlier stage then it did not work for Windows,
now is all OS supported.
Here a test and usage of Pipenv with Windows.
Can look a Python and pip placement.
If want run in a editor is the same way as with virtual environment.
Point to Python version used in environment.
I use VS code,so there is a setting.json file where i can select workspace interpreter.
The documentation look at this video for usage.
I did test it in a earlier stage then it did not work for Windows,
now is all OS supported.
Here a test and usage of Pipenv with Windows.
pip install -U pipenv
# make a folder E:\1 λ mkdir web_title # cd in E:\1 λ cd web_title E:\1\web_title # Activate shell λ pipenv shell Creating a Pipfile for this project... Creating a virtualenv for this project... Using base prefix 'c:\\python36' .... Installing setuptools, pip, wheel...done.At this point this empty folder is a virtual environment.
Can look a Python and pip placement.
E:\1\web_title λ pipenv --venv C:\Users\Tom\.virtualenvs\web_title-vYANOqhT E:\1\web_title λ which python /c/Users/Tom/.virtualenvs/web_title-vYANOqhT/Scripts/python E:\1\web_title λ pip -V pip 9.0.1 from c:\users\tom\.virtualenvs\web_title-vyanoqht\lib\site-packages (python 3.6)Place a file in this folder.
# find_title.py import requests from bs4 import BeautifulSoup def web_title(url): '''find web site title''' url_get = requests.get(url) soup = BeautifulSoup(url_get.content, 'lxml') print(soup.select('head > title')[0].text) if __name__ == '__main__': #url = 'http://CNN.com' url = 'https://www.python.org/' web_title(url)Try to run the file.
E:\1\web_title λ python find_title.py Traceback (most recent call last): File "find_title.py", line 2, in <module> import requests ModuleNotFoundError: No module named 'requests'Pipenv works like pip,so need to install Requests,BeautifulSoup and lxml.
E:\1\web_title λ pipenv install beautifulsoup4 requests lxml # Run again E:\1\web_title λ python find_title.py Welcome to Python.orgLook at dependencies with graph command.
E:\1\web_title λ pipenv graph beautifulsoup4==4.6.0 lxml==3.8.0 pip==9.0.1 requests==2.18.4 - certifi [required: >=2017.4.17, installed: 2017.7.27.1] - chardet [required: <3.1.0,>=3.0.2, installed: 3.0.4] - idna [required: >=2.5,<2.7, installed: 2.6] - urllib3 [required: <1.23,>=1.21.1, installed: 1.22] setuptools==36.4.0 wheel==0.30.0So all work,to get out shell modus(virtualenv) type
exit
.If want run in a editor is the same way as with virtual environment.
Point to Python version used in environment.
I use VS code,so there is a setting.json file where i can select workspace interpreter.
{ "python.pythonPath": "C:\Users\Tom\.virtualenvs\web_title-vYANOqhT\python.exe" }[Image: HBSXCv.jpg]