简体   繁体   English

在虚拟环境python 2.7 pycharm中安装后无法导入请求

[英]unable to import requests after installing in virtual environment python 2.7 pycharm

so I navigate to my virtual environment. 所以我导航到我的虚拟环境。

Activate it 激活它

do pip install requests pip install requests

it installs 它安装

i go to a file and then import requests 我去一个文件,然后import requests

then get this error: 然后得到这个错误:

No module named request less... (Ctrl+F1) 
This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

i did pip install again just to see and I get this: 我做了pip再次安装只是为了看看,我得到了:

pip install requests
Requirement already satisfied: requests in ./lib/python2.7/site-packages
Requirement already satisfied: certifi>=2017.4.17 in ./lib/python2.7/site-packages (from requests)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./lib/python2.7/site-packages (from requests)
Requirement already satisfied: idna<2.7,>=2.5 in ./lib/python2.7/site-packages (from requests)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./lib/python2.7/site-packages (from requests)

Im using pycharm and in a django project. 我在Django项目中使用pycharm。 I dont think either of those matter but just in case. 我认为这些都不重要,以防万一。

The answer was that my pycharm software was set to the global install of python not my virtual env instance. 答案是我的pycharm软件被设置为python的全局安装,而不是我的虚拟环境实例。 I had to set up pycharm to use that env instance, by following the instructions here: 我必须按照以下说明设置pycharm以使用该env实例:

http://exponential.io/blog/2015/02/10/configure-pycharm-to-use-virtualenv/ http://exponential.io/blog/2015/02/10/configure-pycharm-to-use-virtualenv/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 python 的虚拟环境中安装 pip 后无法导入 tensorflow - unable to import tensorflow after I pip install in a virtual environment in python 使用 python 2.7 在 Linux 机器上安装 python 3.7 虚拟环境 - Installing a python 3.7 virtual environment on a Linux machine with python 2.7 无法在Python 2.7.9虚拟环境中导入_winreg - Unable to import _winreg in Python 2.7.9 virtual environment 无法为Python 2.7创建虚拟环境:setuptools因UnicodeEncodeError而失败 - Unable to create a virtual environment for Python 2.7: setuptools fails with UnicodeEncodeError 即使通过pip安装chatterbot软件包以及通过Python解释器在Pycharm上也无法导入Chatterbot - Unable to import Chatterbot even after installing the chatterbot package through pip as well as on Pycharm through Python interpreter Python 2.7 虚拟环境中的脚本 - Python 2.7 Script in Virtual Environment 为python 2.7创建虚拟环境 - create virtual environment for python 2.7 在虚拟环境中安装django后,仍然无法导入模块 - After installing django in virtual environment, still can't import module 从github将Python软件包安装到虚拟环境中,但导入失败 - installing Python package from github into virtual environment works but import fails 在python 2.7上使用pip安装后无法导入渲染 - I can't import render after installing with pip on python 2.7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM