PyCharm 2020.1中TensorFlow安装完成后报错求助(Python3.8)
Hey there, let's work through this installation error you're hitting. The [Errno 2] No such file or directory issue typically stems from corrupted pip caches, missing directory structures, or permission quirks—especially with the Microsoft Store version of Python that your path indicates. Here are step-by-step solutions to resolve it:
1. Clear Pip's Cache and Reinstall
Corrupted cached packages are a common culprit. First, wipe pip's cache to eliminate any broken installation files:
python -m pip cache purge
Then retry the TensorFlow installation with a fresh start:
python -m pip install tensorflow
2. Manually Create the Missing Directory
The error points to a missing __pycache__ folder in the tensorflow_estimator path. Let's create it manually:
- Navigate to
C:\Users\Nabia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tensorflow_estimator\python\estimator\canned\linear_optimizer\python\utils - Right-click in the folder > New > Folder, name it
__pycache__ - Run the installation command again:
python -m pip install tensorflow
3. Switch to the Official Python Distribution (Not Microsoft Store)
Microsoft Store Python often has path and permission limitations that mess with package installations. Try this workaround:
- Download the official Python 3.8 installer from python.org (pick the correct 32/64-bit version for your system)
- During installation, make sure to check the box labeled "Add Python 3.8 to PATH"
- Open PyCharm 2020.1, go to
File > Settings > Project > Python Interpreter - Click the gear icon >
Add > System Interpreter, then select the newly installed Python 3.8 - Now run
python -m pip install tensorflowin PyCharm's terminal
4. Upgrade Pip to the Latest Version
Your pip version (20.1.1) is quite outdated—newer versions fix many installation bugs and compatibility issues. Upgrade first:
python -m pip install --upgrade pip
Then proceed with installing TensorFlow once more.
5. Install Without Using Pip Cache
If cache-related problems persist, bypass the cache entirely to force a fresh download of all packages:
python -m pip install tensorflow --no-cache-dir
Give these steps a try in order—most users fix this issue with either clearing the cache or switching to the official Python build. Let me know if you run into any other snags!
内容的提问来源于stack exchange,提问作者Nabia Salman

