Windows 8.1无GPU环境下安装PyTorch遇问题求助
Hey there! Let's work through that PyTorch import issue you're facing. Since you're running Windows 8.1 with Python 3.6.4 and no GPU, the problem likely stems from installing a CUDA-enabled legacy package when you don't need GPU support. Here's a step-by-step fix:
Step 1: Uninstall the Existing (GPU-focused) Packages
First, remove the packages you installed earlier that include unnecessary CUDA dependencies:
conda uninstall pytorch_legacy cuda80 -y
The -y flag skips confirmation prompts to speed up the process.
Step 2: Install a CPU-only PyTorch Version Compatible with Python 3.6.4
Python 3.6.4 is an older release, so we need to pick a PyTorch version that still supports it. Versions 1.1.0 and 1.2.0 are reliable fits for this setup. Use this conda command to install the CPU-only build:
conda install pytorch==1.1.0 torchvision==0.3.0 cpuonly -c pytorch
This ensures you get a build tailored for CPUs, with no extra GPU/CUDA baggage that might cause conflicts on your system.
Alternative: Use Pip if Conda Runs Into Dependency Issues
If conda struggles to resolve dependencies, try using pip instead (make sure you're still in your activated virtual environment):
pip install torch==1.1.0+cpu torchvision==0.3.0+cpu
This installs pre-built CPU wheels specifically compatible with Python 3.6.
Step 3: Verify the Installation
Once the install finishes, open a Python shell in your virtual environment and run these commands to confirm everything works:
import torch print(torch.__version__) # Should output 1.1.0 print(torch.cuda.is_available()) # Should return False (since you have no GPU)
If these run without errors, you're all set!
Why Your Original Install Caused Issues
The peterjc123 legacy package you installed includes CUDA 8.0 support, which is unnecessary for a CPU-only setup. This extra dependency can lead to missing DLLs or compatibility conflicts on Windows 8.1, especially with older Python versions. Installing the dedicated CPU build eliminates these conflicts entirely.
内容的提问来源于stack exchange,提问作者giosans

