无法在PyCharm中安装Flask [英] Unable to install Flask in PyCharm

查看:89
本文介绍了无法在PyCharm中安装Flask的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PyCharm中安装Flask时遇到问题.尝试运行 pip install flask 时,出现以下错误.

 错误:命令错误,退出状态为1:命令:'c:\ Users \ rohit \ AppData \ Local \ Programs \ Python \ Python38-32 \ python.exe'-u -c'import sys,setuptools,tokenize;sys.argv [0] =''"'C:\\ Users \\ rohit \\ AppData \\ Local \\ Temp \\ pip-install-7tccrr01 \\ MarkupSafe \\ setup.py''"';__file __ =''"'C:\\ Users \\ rohit \\ AppData \\ Local \\ Temp \\ pip-install-7tccrr01 \\ MarkupSafe \\ setup.py''"'; f = getattr(tokenize,'"'open'"'',打开)(__ file __); code = f.read().replace('"''\ r \ n'"'','"''\n''"'); f.close(); exec(compile(code,__file__,''"'exec''"'))'安装--record'C:\ Users \ rohit \ AppData \Local \ Temp \ pip-record-q_wdekk3 \ install-record.txt'-单一版本-外部管理-编译CWD:C:\ Users \ rohit \ AppData \ Local \ Temp \ pip-install-7tccrr01 \ MarkupSafe \完整的输出(23行):运行安装运行构建运行build_py创建版本创建build \ lib.win32-3.8创建build \ lib.win32-3.8 \ markupsafe复制src \ markupsafe \ _compat.py->build \ lib.win32-3.8 \ markupsafe复制src \ markupsafe \ _constants.py->build \ lib.win32-3.8 \ markupsafe复制src \ markupsafe \ _native.py->build \ lib.win32-3.8 \ markupsafe复制src \ markupsafe \ __ init__.py->build \ lib.win32-3.8 \ markupsafe运行egg_info编写src \ MarkupSafe.egg-info \ PKG-INFO将dependency_links写入src \ MarkupSafe.egg-info \ dependency_links.txt将顶级名称写入src \ MarkupSafe.egg-info \ top_level.txt读取清单文件"src \ MarkupSafe.egg-info \ SOURCES.txt"阅读清单模板"MANIFEST.in"找不到与"docs \ _build"匹配的先前包含的目录警告:分发中的任何位置都找不到与"* .py [co]"匹配的先前包含的文件编写清单文件"src \ MarkupSafe.egg-info \ SOURCES.txt"复制src \ markupsafe \ _speedups.c->build \ lib.win32-3.8 \ markupsafe运行build_ext建立'markupsafe._speedups'扩展错误:[WinError 3]系统找不到指定的路径:'C:\\ Program Files(x86)\\ Microsoft SDKs \\ Windows \\ v8.1 \\ lib'----------------------------------------错误:命令错误,退出状态为1:'c:\ Users \ rohit \ AppData \ Local \ Programs \ Python \ Python38-32 \ python.exe'-u -c'import sys,setuptools,tokenize;sys.argv [0] =''"'C:\\ Users \\ rohit \\ AppData \\ Local \\ Temp \\ pip-install-7tccrr01 \\ MarkupSafe \\ setup.py''"';__file __ =''"'C:\\ Users \\ rohit \\ AppData \\ Local \\ Temp \\ pip-install-7tccrr01 \\ MarkupSafe \\ setup.py''"'; f = getattr(tokenize,'"'open'"'',打开)(__ file __); code = f.read().replace('"''\ r \ n'"'','"''\n''"'); f.close(); exec(compile(code,__file__,''"'exec''"'))'安装--record'C:\ Users \ rohit \ AppData \Local \ Temp \ pip-record-q_wdekk3 \ install-record.txt'--single-version-externally-managed --compile检查日志以获取完整的命令输出. 

解决方案

默认情况下,PyCharm使用pip管理项目包.要管理用于项目解释程序的Python程序包,请在项目设置/首选项中选择项目解释器"页面,或在"Python解释器"小部件中选择解释器设置.

选择文件-> 设置-> 项目: project_name-> 项目解释器.单击屏幕截图中鼠标光标标记的 + 按钮,以在所选项目中安装Python软件包.

搜索烧瓶.选择它,然后单击可用软件包"窗口左下角的安装软件包按钮进行安装.PyCharm将自动为您选择软件包版本,或者您可以选中指定版本左侧的复选框,然后从指定版本下拉菜单中选择软件包版本.

只要您

然后选中继承全局站点包复选框,然后单击创建项目"窗口右下角的创建按钮.

I have trouble installing Flask in PyCharm. I got the following errors when I tried to run pip install flask.

ERROR: Command errored out with exit status 1:
     command: 'c:\Users\rohit\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\rohit\\AppData\\Local\\Temp\\pip-install-7tccrr01\\MarkupSafe\\setup.py'"'"'; __file__='"'"'C:\\Users\\rohit\\AppData\\Local\\Temp\\pip-install-7tccrr01\\MarkupSafe\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\rohit\AppData\Local\Temp\pip-record-q_wdekk3\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\rohit\AppData\Local\Temp\pip-install-7tccrr01\MarkupSafe\
    Complete output (23 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.8
    creating build\lib.win32-3.8\markupsafe
    copying src\markupsafe\_compat.py -> build\lib.win32-3.8\markupsafe
    copying src\markupsafe\_constants.py -> build\lib.win32-3.8\markupsafe
    copying src\markupsafe\_native.py -> build\lib.win32-3.8\markupsafe
    copying src\markupsafe\__init__.py -> build\lib.win32-3.8\markupsafe
    running egg_info
    writing src\MarkupSafe.egg-info\PKG-INFO
    writing dependency_links to src\MarkupSafe.egg-info\dependency_links.txt
    writing top-level names to src\MarkupSafe.egg-info\top_level.txt
    reading manifest file 'src\MarkupSafe.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs\_build'
    warning: no previously-included files matching '*.py[co]' found anywhere in distribution
    writing manifest file 'src\MarkupSafe.egg-info\SOURCES.txt'
    copying src\markupsafe\_speedups.c -> build\lib.win32-3.8\markupsafe
    running build_ext
    building 'markupsafe._speedups' extension
    error: [WinError 3] The system cannot find the path specified: 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1\\lib'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\Users\rohit\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\rohit\\AppData\\Local\\Temp\\pip-install-7tccrr01\\MarkupSafe\\setup.py'"'"'; __file__='"'"'C:\\Users\\rohit\\AppData\\Local\\Temp\\pip-install-7tccrr01\\MarkupSafe\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\rohit\AppData\Local\Temp\pip-record-q_wdekk3\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

解决方案

By default, PyCharm uses pip to manage project packages. To manage Python packages for the project interpreter, select the Project Interpreter page in the project Settings/Preferences or select Interpreter Settings in the Python Interpreter widget.

Select File -> Settings -> Project: project_name -> Project Interpreter. Click the + button which is marked by the mouse cursor in the screenshot to install Python packages in the selected project.

Search for Flask. Select it and click the Install Package button in the lower left corner of the Available Packages window to install it. PyCharm will automatically choose the package version for you or you can check the checkbox to the left of Specify version and select the package version from the Specify version dropdown menu.

Whenever you install a Python package specifically for a project, PyCharm adds the packages that were installed to the project's venv directory where PyCharm will find them automatically.

PyCharm does not automatically find your globally installed Python packages unless the project has been configured to find them. To do this select the Inherit global-site packages option when you create a new project.

Select File -> New Project to create a new project. Click the triangle marked by the mouse cursor in the below screenshot to show the new project's options.

Then check the Inherit global-site packages checkbox and click the Create button in the lower right corner of the Create Project window.

这篇关于无法在PyCharm中安装Flask的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆