我一直在iPython中得到这个(众所周知的)错误。然而,相同的导入在纯Python中运行良好。 (Python 3.3.5,详见下文)
IPython的:
Python 3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014, 10:37:12) [MSC v.1600 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 2.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import test1
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-ddb30f03c287> in <module>()
----> 1 import test1
ImportError: DLL load failed: The specified module could not be found.
Python(不仅它加载正常,它也有效):
$ python
Python 3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014, 10:37:12) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import test1
>>>
现在,test1.pyd上的Dependency Walker显示了这个
[ ? ] LIBGCC_S_DW2-1.DLL Error opening file. The system cannot find the file specified (2).
[ ? ] LIBSTDC++-6.DLL Error opening file. The system cannot find the file specified (2).
[ ? ] PYTHON33.DLL Error opening file. The system cannot find the file spec
我甚至用普通的Python覆盖了iPython中的sys.path。文件test1.pyd位于C:\ Test。
['c:\\Test',
'c:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\python33.zip',
'c:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\DLLs',
'c:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib',
'c:\\WinPython-32bit-3.3.5.0\\python-3.3.5',
'c:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages',
'c:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\FontTools',
'c:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\win32',
'c:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\win32\\lib',
'c:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\Pythonwin']
为什么导入工作在纯Python中,而不在iPython中?
答案 0 :(得分:0)
我遇到了同样的问题。经过几个小时的思考和思考区别在于IDE选择使用的解释之间的环境变量。 (普通python和ipython或pycharm等)我认为你可以在ipython中使用import os
os.environ
来检查文本。然后使用(在python 3.7中工作)
1、os.environ['环境变量名称']='环境变量值' #其中key和value均为string类型
2、os.putenv('环境变量名称', '环境变量值')
检查文字。 然后,如果有差异。很多人应该在跑步之前设置正确的。 实际上有很多方法可以设置envs。例如
df<- read.table(header = T, text = "Name Rate
A 10
D 11
C 11
E 12
B 13
F 14")
df$rnk<- rank(df$Rate, na.last = T,ties.method = "average")
df
require(dplyr)
finaldf<- df %>% group_by(rnk) %>% mutate(Rank=floor(rnk)+ order(Name)-1) %>%
as.data.frame %>% select(c(Name,Rate,Rank))
finaldf
希望对你有所帮助。~~~ ///(^ v ^)\\ ~~~