You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决setup.py文件不存在错误并在Python IDLE中安装folium模块

Fixing "setup.py not found" Error and Getting Folium Working in IDLE

Hey there! Let's work through your problems one by one.

First: Why you're getting the setup.py error

The command python setup.py install only works if you're in a directory that actually has a setup.py file—this is used for installing Python packages from their raw source code. Since you don't have that file in your current terminal directory, you're seeing that "No such file or directory" error.

Unless you specifically need to install folium from its source code, you don't need to use this command at all. Your existing attempts with pip/conda are the right approach—we just need to make sure that installation is accessible to IDLE.

Getting Folium to Work in IDLE

The issue here is that PyCharm and IDLE are probably using different Python environments. Here's how to fix that:

  1. Find out which Python interpreter IDLE is using

    • Open IDLE, and check the top of the shell window—it'll show something like Python 3.10.12 (main, Jun 11 2024, 05:26:28) [GCC 11.4.0] on linux
    • For a precise path, run this in the IDLE shell:
      import sys
      print(sys.executable)
      
      This will output the full path to the Python executable IDLE is using (like /home/yourname/miniconda3/bin/python or /usr/bin/python3.10).
  2. Install folium directly for that interpreter

    • Open your terminal, and use that path to run pip. For example, if the path was /usr/bin/python3.10, run:
      /usr/bin/python3.10 -m pip install folium
      
    • If you're using a conda environment:
      • First activate the environment in your terminal (e.g., conda activate your_env_name)
      • Then run pip install folium
      • After that, open IDLE from the same terminal session (just type idle and hit enter)—this will launch IDLE using the activated conda environment.
  3. Verify the installation
    Open IDLE again and run import folium. If you don't get any error messages, you're all set!

If you do want to install from source (optional)

If you need to use setup.py install for some reason, follow these steps:

  • Download the folium source code (as a ZIP file from the project's repository)
  • Unzip the file to a folder on your computer
  • Open your terminal, navigate to that unzipped folder (use cd /path/to/unzipped/folium-folder)
  • Now run python setup.py install—this will work because the folder contains the required setup.py file.

内容的提问来源于stack exchange,提问作者Andrews

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 07:05:06