【问题标题】:Python file pointing to wrong python installationPython文件指向错误的python安装
【发布时间】:2019-09-18 22:05:36
【问题描述】:
F:>where python
C:\Program Files (x86)\Python37-32\python.exe

F:>PyInstallerFile.py
Traceback (most recent call last):
File 
"F:\PyInstallerFile.py", line 13, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']

我正在尝试从 cmd 运行我的 .py 文件,我的 python 安装在

C:\Program Files (x86)\Python37-32\

同样已添加到环境路径变量中,那么为什么当我运行 PyInstallerFile.py 文件时它指向

C:\ProgramData\Anaconda3\lib\site-packages\pandas__init__.py

文件夹而不是指向 ProgramFiles 文件夹。

我在这里缺少什么,我应该怎么做才能更改这个默认的 python 位置

我可以看到类似的问题here,但它是针对 Linux 环境的,我需要在 Windows 上解决这个问题。

【问题讨论】:

  • 你需要安装numpy,因为它是pandas的依赖项
  • 可能用于运行“.py”文件的安装与PATH中的安装不同,即where python的结果。你试过运行python PyInstallerFile.py吗?
  • python PyInstallerFile.py 可以工作,但 PyInstallerFile.py 不能工作,因为它指向 anaconda 位置

标签: python python-3.x anaconda environment-variables


【解决方案1】:

安装最新版本的 numpy 1.16.x 在我的情况下,问题解决了:

python3 -m pip unistall numpy
python3 -m pip install numpy==1.14.3 

【讨论】:

  • 不是numpy的问题,是python安装和Anaconda安装之间的问题。
  • 你也可以删除anaconda,然后用解释器“C:\Program Files\Python36\python.exe”定义pycharm,然后它就会开始工作了。
【解决方案2】:

虽然我的环境变量中添加了 python,但不确定是什么问题,但是卸载 anaconda 然后将 python 作为我的主要工作区解决了这个问题

【讨论】:

    猜你喜欢
    • 2020-08-13
    • 2018-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-19
    • 2016-04-28
    • 2014-11-23
    • 2016-11-27
    相关资源
    最近更新 更多