我已经在Windows 10上将Anaconda与python一起安装。我已经创建了一个名为venv
的Anaconda虚拟环境。激活环境后,>>>python
给出:
Python 3.6.8 |Anaconda, Inc.| (default, Feb 11 2019, 15:03:47) [MSC v.1915 64 bit (AMD64)] on win32
我已使用scipy
点在venv
中安装了pip install scipy
。
我已将pycharm中的解释器设置为venv
python解释器。
现在,我在pycharm的新模块中尝试了以下操作:
import scipy # No error here
from scipy.stats import norm # Here I got the error
错误:
Traceback (most recent call last):
File "C:/Users/user/Documents/February2019/AVEC2018/ApplyPCA.py", line 11, in <module>
from scipy.optimize import _hungarian
File "C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv\lib\site-packages\scipy\optimize\__init__.py", line 386, in <module>
from .optimize import *
File "C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv\lib\site-packages\scipy\optimize\optimize.py", line 37, in <module>
from .linesearch import (line_search_wolfe1, line_search_wolfe2,
File "C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv\lib\site-packages\scipy\optimize\linesearch.py", line 18, in <module>
from scipy.optimize import minpack2
ImportError: DLL load failed: The specified module could not be found.
我已按照here的说明尝试解决此问题。
因此,我在cmd中使用print(os.environ['PATH'])
python解释器时运行了venv
(即,在激活venv
之后);我复制了以下结果
C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv;C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv\Library\mingw-w64\bin;C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv\Library\usr\bin;C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv\Library\bin;C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv\Scripts;C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MATLAB\R2017a\runtime\win64;C:\Program Files\MATLAB\R2017a\bin;C:\Users\user\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\cuda7\cuda\bin;C:\Program Files\Weka-3-8;C:\Users\user\Downloads\ffmpeg-20170904-6cadbb1-win64-static\bin;C:\Program Files\Java\jdk1.8.0_144\bin;C:\Program Files\Java\jre1.8.0_144\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\user\Downloads\pandoc-2.1.2;C:\Users\user\AppData\Local\Continuum\anaconda3\Scripts;C:\Users\user\AppData\Local\Continuum\anaconda3;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\user\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;C:\Users\user\Downloads\cmake-3.11.2-win64-x64\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\extras\CUPTI\libx64;C:\Program Files\NVIDIA Corporation\NVSMI;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Cloud SDK\google-cloud-sdk\bin;C:\altera\13.0\modelsim_ase\win32aloem;C:\Program Files\Microsoft VS Code\bin;C:\Users\user\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\;C:\Users\user\AppData\Local\Continuum\anaconda3\envs\venv\lib\site-packages\numpy\.libs
将其粘贴到运行/调试配置和 python控制台中的新变量中,如下所示:
但这并不能解决问题。请注意,我尝试使用scipy
安装conda install scipy
,但问题尚未解决。最后,在cmd中工作时不会出现此问题,但在python控制台(在pycharm中)和pycharm中工作时确实存在。
我发现在pycharm内的python控制台中运行print(os.environ['PATH'])
给了我以下信息:
C:\Users\iayou005\AppData\Local\Continuum\anaconda3\envs\venv\Library\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MATLAB\R2017a\runtime\win64;C:\Program Files\MATLAB\R2017a\bin;C:\Users\iayou005\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\cuda7\cuda\bin;C:\Program Files\Weka-3-8;C:\Users\iayou005\Downloads\ffmpeg-20170904-6cadbb1-win64-static\bin;C:\Program Files\Java\jdk1.8.0_144\bin;C:\Program Files\Java\jre1.8.0_144\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\iayou005\Downloads\pandoc-2.1.2;C:\Users\iayou005\AppData\Local\Continuum\anaconda3\Scripts;C:\Users\iayou005\AppData\Local\Continuum\anaconda3;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\iayou005\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;C:\Users\iayou005\Downloads\cmake-3.11.2-win64-x64\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\extras\CUPTI\libx64;C:\Program Files\NVIDIA Corporation\NVSMI;C:\Users\iayou005\AppData\Local\Microsoft\WindowsApps;C:\Cloud SDK\google-cloud-sdk\bin;C:\altera\13.0\modelsim_ase\win32aloem;C:\Program Files\Microsoft VS Code\bin;C:\Users\iayou005\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\;
因此,缺少以下2条路径:
C:/Users/user/AppData/Local/Continuum/anaconda3/envs/venv;C:/Users/user/AppData/Local/Continuum/anaconda3/envs/venv/Scripts;
鉴于上述所有尝试,我不知道如何解决此问题
非常感谢您的帮助!
答案 0 :(得分:2)
似乎您在配置对话框中放错了环境变量的名称及其值。
应该为python3
,而不是pudb3