I am trying to install the Python http package into a virtual environment on my Mac so I can run the Simple HTTP Server but pip complains that it can't import Request from request:
% pip install http
...
ImportError: cannot import name 'Request' from 'request' (/Users/me/.virtualenvs/base/lib/python3.7/site-packages/request/__init__.py)
I installed the request package initially but that didn't help. Thinking that perhaps it needed requests instead, I installed that too to no avail.
Here is my virtual environment:
Package Version
---------------- ---------
certifi 2019.9.11
chardet 3.0.4
get 2019.4.13
idna 2.8
pip 19.3
post 2019.4.13
powerline-status 2.7
psycopg2-binary 2.8.3
public 2019.4.13
query-string 2019.4.13
request 2019.4.13
requests 2.22.0
setuptools 41.1.0
urllib3 1.25.6
wheel 0.33.4
I'm running Python 3.7.4 inside a virtual environment built from virtualenv 16.6.2. on macOS Mojave.
upgrade your pip with the below command and try again
python -m pip install –upgrade pip
If the above fails you can also try an earlier version for which it works
pip install --upgrade pip==9.0.3
The error could be because in the current pip, you have to pip install requests module first this in not taken care internally as the dependency is removed
You should not have to install anything to run SimpleHTTPServer
. http
is in the standard libary.
Also note that SimpleHTTPServer
is called http.server
in Python 3.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.