简体   繁体   English

Pycharm运行/调试不适用于tensorflow

[英]Pycharm Run/Debug not working with tensorflow

I am on Windows 7 with python 3.5.4 and Pycharm Community Edition 2017.2 我在Windows 7上使用python 3.5.4和Pycharm Community Edition 2017.2

When I execute my python script in the cmd.exe it works fine. 当我在cmd.exe中执行python脚本时,它可以正常工作。 But when using the Run or Debug tools in Pycharm I get this error: 但是在Pycharm中使用运行或调试工具时,出现此错误:

  Traceback (most recent call last):
  File "C:\Users\xy\my_project\env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Users\xy\AppData\Local\Continuum\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.

Now I am familiar with this specific error. 现在,我已经熟悉了这个特定的错误。 Usually this occures if Microsoft Visual C++ Redistributable (or Visual Studio) is not installed. 如果未安装Microsoft Visual C ++ Redistributable(或Visual Studio),通常会发生这种情况。 But this is not the case since I have installed the Microsoft Visual C++ 2015 Redistributable Update 3 (that's why the python script is working on the console). 但是情况并非如此,因为我已经安装了Microsoft Visual C ++ 2015 Redistributable Update 3(这就是在控制台上运行python脚本的原因)。

My guess is, that I have to add some Path to Pycharm? 我的猜测是,我必须向Pycharm添加一些路径吗? But I do not know where or which one. 但我不知道在哪里或哪一个。

This is how I resolved the issue: 这是我解决问题的方法:

Open cmd.exe -> Create virtual env -> start Pycharm (pycharm.bat) from there 打开cmd.exe->创建虚拟环境->从那里启动Pycharm(pycharm.bat)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM