我正处于集成一些Python的早期阶段,以便在Matlab中调用一些计算,并将所有数据汇总到我将要使用的html生成中L.xist公司. 我最初安装的是32位的python2.7.5,但是在64位matlabr2015a安装中,我无法使用该版本Python的Matlab引擎。然后我下载了一个64位版本的Python2.7.9,并尝试在llxist中做一个pip,显然它没有得到很好的维护并且失败了。然后我下载了python3.4.364bit,下载了L.xist公司安装程序ll-xist-5.13.win-amd64-py3.4.exe并认为我可以走了。我不得不做一个小动作来拉腹肌,结果成功了。在
现在我要从控制台调用python文件了。如果我以python
开头调用它,那么一切都很好,如果我不这样做,导入就无法识别。什么能解释这种差异呢?看起来在我安装的不同版本之间有一些安装障碍,不知怎么的,路径上的python版本没有被恰当地调用,我猜2.7.9版本的python正在被调用,因为这个安装从来没有被调用过L.xist公司安装了,但我的2.7.5安装了。在
C:\Temp>python MyScript.py a.txt b.txt
file1: a.txt
file2: b.txt
C:\Temp>MyScript.py a.txt b.txt
Traceback (most recent call last):
File "C:\Temp\MyScript.py", line 20, in <module>
from ll.xist import xsc
ImportError: No module named ll.xist
这也是一个健全的检查。。。在
^{pr2}$
检查.py的文件关联。虽然正确的安装可能在您的路径中,但文件关联可能仍指向其他版本。在
您可以通过在测试脚本中导入
sys
模块并调用print(sys.version)
来检查这一点。然后用python test.py
运行测试脚本,只运行test.py
来查看打印的版本。在原来这里的控制问题是Python Launcher for Windows.
在我的控制台上,我可以通过py命令看到“默认”版本。。。在
这是最基本的解决方法。。。在
我要在我的剧本中添加的第一行是
^{pr2}$伟大的评论链接here以了解发射器背后的细节和动机。在
相关问题 更多 >
编程相关推荐