找不到文件python.h

时间:2019-09-20 11:20:14

标签: python python-3.x bash anaconda macports

我正在尝试运行gnu make,但是它说找不到python.h文件,我认为这是由于未正确安装Python造成的。

我一直在努力寻找最佳的安装Python的方法,首先是通过Macports在3.6版中安装它,然后像使用pycharm一样安装anaconda,这使安装软件包变得容易得多,尽管我现在觉得我的Python安装可以造成混乱。

python --version返回:Python 3.7.3

cat .bash_profile返回:

##
# Your previous /Users/jonathandyke/.bash_profile file was backed up as /Users/jonathandyke/.bash_profile.macports-saved_2019-06-30_at_22:20:05
##

# MacPorts Installer addition on 2019-06-30_at_22:20:05: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.


# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
# added by Anaconda3 2019.03 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<````

1 个答案:

答案 0 :(得分:0)

您可能以某种方式弄乱了头文件。试试

brew uninstall python3
brew install python3

如果您在Ubuntu上 apt-get install python3-dev应该这样做