conda創(chuàng)建pytorch環(huán)境報錯
昨天訓(xùn)練數(shù)據(jù)的時候,發(fā)現(xiàn)Anaconda占用C盤達(dá)到了20G(暑假在cmd狀態(tài)下安裝的,默認(rèn)下載到了C盤),心道再創(chuàng)建幾個環(huán)境,C盤就要爆紅了,于是重裝Anaconda到了D盤,不過之后的初始化并不順利--創(chuàng)建pytorch環(huán)境總是失敗,網(wǎng)上查閱了許多資料:配置path環(huán)境變量,關(guān)閉VPN,.condarc文件刪除或添加路徑,更換清華源等等都無果。報錯如下:
>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\Users\86150\anaconda3\Lib\site-packages\conda\exception_handler.py", line 17, in __call__
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\86150\anaconda3\Lib\site-packages\conda\cli\main.py", line 54, in main_subshell
parser = generate_parser(add_help=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\86150\anaconda3\Lib\site-packages\conda\cli\conda_argparse.py", line 127, in generate_parser
configure_parser_plugins(sub_parsers)
File "C:\Users\86150\anaconda3\Lib\site-packages\conda\cli\conda_argparse.py", line 354, in configure_parser_plugins
else set(find_commands()).difference(plugin_subcommands)
^^^^^^^^^^^^^^^
File "C:\Users\86150\anaconda3\Lib\site-packages\conda\cli\find_commands.py", line 71, in find_commands
for entry in os.scandir(dir_path):
^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 123] 文件名、目錄名或卷標(biāo)語法不正確。: 'D:\\1瀵邦喕淇?緇嬪\ue0c5綈璡瀵邦喕淇妛eb瀵\ue1b9偓閸欐垼鈧\ue100懎浼愰崗絀僤ll'
`$ C:\Users\86150\anaconda3\Scripts\conda-script.py config --set show_channel_urls yes`
environment variables:
CIO_TEST=<not set>
CLASSPATH=.;C:\Program Files\Java\jdk1.8.0_221\bin;C:\Program
Files\Java\jdk1.8.0_221\lib\dt.jar;C:\Program
Files\Java\jdk1.8.0_221\lib\tools.jar;D:\sqljdbc4\sqljdbc4.jar
CONDA_DEFAULT_ENV=pytorch
CONDA_EXE=C:\Users\86150\anaconda3\condabin\..\Scripts\conda.exe
CONDA_EXES="C:\Users\86150\anaconda3\condabin\..\Scripts\conda.exe"
CONDA_PREFIX=C:\Users\86150\anaconda3\envs\pytorch
CONDA_PREFIX_1=C:\Users\86150\anaconda3
CONDA_PROMPT_MODIFIER=(pytorch)
CONDA_PYTHON_EXE=C:\Users\86150\anaconda3\python.exe
CONDA_ROOT=C:\Users\86150\anaconda3
CONDA_SHLVL=2
CURL_CA_BUNDLE=<not set>
HOMEPATH=\Users\86150
LD_PRELOAD=<not set>
NODE_PATH=D:\1微信小程序\node\node_global\node_modules
PATH=C:\Users\86150\anaconda3\envs\pytorch;C:\Users\86150\anaconda3\envs\py
torch\Library\mingw-
w64\bin;C:\Users\86150\anaconda3\envs\pytorch\Library\usr\bin;C:\Users
\86150\anaconda3\envs\pytorch\Library\bin;C:\Users\86150\anaconda3\env
s\pytorch\Scripts;C:\Users\86150\anaconda3\envs\pytorch\bin;C:\Users\8
6150\anaconda3\condabin;E:\;E:\VM\bin;E:\app\Qracleinstall\product\12.
2.0\dbhome_1\bin;C:\Program Files\Microsoft MPI\Bin;C:\WINDOWS\system3
2;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPower
Shell\v1.0;C:\WINDOWS\System32\OpenSSH;E:\bin;C:\Program
Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program
Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Program
Files\Java\jdk1.8.0_221\bin;D:\apache-
tomcat-9.0.37-windows-x64\apache-tomcat-9.0.37\bin;C:\Program
Files\Java\jdk1.8.0_221\jre\bin;C:\Program Files\dotnet;C:\Program
Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;D:\x64\瀵邦喕淇妛
eb瀵偓閸欐垼鈧懎浼愰崗絀僤ll;D:\1瀵邦喕淇?緇嬪綈璡瀵邦喕淇妛eb瀵偓閸欐垼鈧懎浼愰崗絀僤ll;D:\1瀵邦喕淇婄亸蹇曗柤
;\node;C:\Program Files (x86)\MySQL;D:\Git\Git\cmd;E:\Xshell;C:\Users\
86150\anaconda3;C:\Users\86150\anaconda3\Library\mingw-
w64\bin;C:\Users\86150\anaconda3\Library\usr\bin;C:\Users\86150\anacon
da3\Library\bin;C:\Users\86150\anaconda3\Scripts;D:\Python\python3.11.
5\Scripts;D:\Python\python3.11.5;C:\Users\MySQL\MySQL Server 8.0\bin;C
:\Users\86150\AppData\Local\Microsoft\WindowsApps;.;C:\Users\86150\.do
tnet\tools;C:\Users\86150\AppData\Local\Microsoft\WindowsApps;D:\1瀵邦喕淇
婄亸蹇曗柤鎼村猾node\node_global;E:\Python\PyCharm Community Edition
2023.1.3\bin;.;C:\Users\86150\Python 3.11;D:\Microsoft VS Code\bin
PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\Windows
PowerShell\v1.0\Modules;C:\Users\86150\Desktop\編程;
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=C:\Users\86150\anaconda3\Library\ssl\cacert.pem
active environment : pytorch
active env location : C:\Users\86150\anaconda3\envs\pytorch
shell level : 2
user config file : C:\Users\86150\.condarc
populated config files : C:\Users\86150\.condarc
conda version : 23.7.4
conda-build version : 3.26.1
python version : 3.11.5.final.0
virtual packages : __archspec=1=x86_64
__win=0=0
base environment : C:\Users\86150\anaconda3 (writable)
conda av data dir : C:\Users\86150\anaconda3\etc\conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\86150\anaconda3\pkgs
C:\Users\86150\.conda\pkgs
C:\Users\86150\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\86150\anaconda3\envs
C:\Users\86150\.conda\envs
C:\Users\86150\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/23.7.4 requests/2.31.0 CPython/3.11.5 Windows/10 Windows/10.0.19045
administrator : False
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
If you suspect this error is being caused by a malfunctioning plugin,
consider using the --no-plugins option to turn off plugins.
Example: conda --no-plugins install <package>
Alternatively, you can set the CONDA_NO_PLUGINS environment variable on
the command line to run the command without plugins enabled.
Example: CONDA_NO_PLUGINS=true conda install <package>
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers? [y/N]:
No report sent. To permanently opt-out, use
$ conda config --set report_errors false又看到安裝Anaconda時,選擇JUST ME默認(rèn)環(huán)境路徑在annconda/env下,而選擇ALL USERS默認(rèn)環(huán)境路徑則在C盤.anaconda/env文件夾下。卸載后又重裝了Anaconda,先是選擇JUST ME,報相同的錯誤,又重裝后選擇ALL USERS,創(chuàng)建pytorch還是相同的錯誤。
無奈之下,再次把Anaconda安裝到C盤,這時候執(zhí)行conda create -n pytorch python=3.8命令是沒問題的,環(huán)境可以成功創(chuàng)建。conda activate pytorch激活環(huán)境也沒問題,不過最重要的一步--安裝torch又出錯了,pytorch官網(wǎng)的conda代碼,清華源,華科源都報相同的錯誤(上述代碼)。Google/GitHub/CSDN/Stack Overflow/博客園等等都查了一遍,都沒出現(xiàn)過類似的問題。晚上睡覺的時候心想難道要重裝下系統(tǒng)?
還好山重水復(fù)疑無路,下午在知乎瀏覽技術(shù)貼的時候看到一句話“pip 或者 conda的時候經(jīng)常被混合使用,這兩者也通常被認(rèn)為是幾乎相同的,盡管他們的很多功能是重疊的。“
突然意識到pip install 和conda install的功能應(yīng)該是相同的。興致沖沖在Anaconda Prompt命令行鍵入:pip3 install torch torchvision torchaudio,等待一段時間后torch終于下載成功。又進(jìn)入python環(huán)境中導(dǎo)入的torch包,輸出了torch的版本
>>> import torch >>> torch.__version__ '2.1.1+cpu'
這下終于塵埃落定,解決掉這個難題了。
到此這篇關(guān)于conda創(chuàng)建pytorch環(huán)境報錯的文章就介紹到這了,更多相關(guān)conda創(chuàng)建pytorch環(huán)境內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Python面試之os.system()和os.popen()的區(qū)別詳析
Python調(diào)用Shell,有兩種方法:os.system(cmd)或os.popen(cmd)腳本執(zhí)行過程中的輸出內(nèi)容,下面這篇文章主要給大家介紹了關(guān)于Python面試之os.system()和os.popen()區(qū)別的相關(guān)資料,需要的朋友可以參考下2022-06-06
使用python進(jìn)行文本預(yù)處理和提取特征的實例
今天小編就為大家分享一篇使用python進(jìn)行文本預(yù)處理和提取特征的實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-06-06

