anaconda 包管理
使用conda create -e test2
创建环境test2
python -m import numpy numpy.__file__
-> /home/xx/.local/lib/python3.8/site-packages/numpy/__init__.py
which pip
-> /usr/bin/pip
使用conda create -n test3 python=3.8
创建环境test3
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main None
_openmp_mutex pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu None
ca-certificates pkgs/main/linux-64::ca-certificates-2023.01.10-h06a4308_0 None
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.38-h1181459_1 None
libffi pkgs/main/linux-64::libffi-3.4.2-h6a678d5_6 None
libgcc-ng pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1 None
libgomp pkgs/main/linux-64::libgomp-11.2.0-h1234567_1 None
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1 None
ncurses pkgs/main/linux-64::ncurses-6.4-h6a678d5_0 None
openssl pkgs/main/linux-64::openssl-1.1.1t-h7f8727e_0 None
pip pkgs/main/linux-64::pip-23.0.1-py38h06a4308_0 None
python pkgs/main/linux-64::python-3.8.16-h7a1cb2a_3 None
readline pkgs/main/linux-64::readline-8.2-h5eee18b_0 None
setuptools pkgs/main/linux-64::setuptools-66.0.0-py38h06a4308_0 None
sqlite pkgs/main/linux-64::sqlite-3.41.2-h5eee18b_0 None
tk pkgs/main/linux-64::tk-8.6.12-h1ccaba5_0 None
wheel pkgs/main/linux-64::wheel-0.38.4-py38h06a4308_0 None
xz pkgs/main/linux-64::xz-5.2.10-h5eee18b_1 None
zlib pkgs/main/linux-64::zlib-1.2.13-h5eee18b_0 None
在这里面pip
和python38
都被安装了
之后which pip
-> /home/xx/anaconda3/envs/test3/bin/pip
先pip uninstall numpy
这里卸载位于系统.local/lib/python3.8/site-packages/numpy
中的numpy,然后使用pip install numpy
,这时候,numpy
安装在/home/xx/anaconda3/envs/test3/lib/python3.8/site-packages/numpy/__init__.py
。
使用conda create -n test
,python版本是3.8,但是这里不会在lib里安装pip
和python38
。如果使用conda install numpy
,则会安装python3.11
和pip
。也意味着python被更新了
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main None
_openmp_mutex pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu None
blas pkgs/main/linux-64::blas-1.0-mkl None
bzip2 pkgs/main/linux-64::bzip2-1.0.8-h7b6447c_0 None
ca-certificates pkgs/main/linux-64::ca-certificates-2023.01.10-h06a4308_0 None
intel-openmp pkgs/main/linux-64::intel-openmp-2021.4.0-h06a4308_3561 None
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.38-h1181459_1 None
libffi pkgs/main/linux-64::libffi-3.4.2-hxx6a678d5_6 None
libgcc-ng pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1 None
libgomp pkgs/main/linux-64::libgomp-11.2.0-h1234567_1 None
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1 None
libuuid pkgs/main/linux-64::libuuid-1.41.5-h5eee18b_0 None
mkl pkgs/main/linux-64::mkl-2021.4.0-h06a4308_640 None
mkl-service pkgs/main/linux-64::mkl-service-2.4.0-py311h5eee18b_0 None
mkl_fft pkgs/main/linux-64::mkl_fft-1.3.1-py311h30b3d60_0 None
mkl_random pkgs/main/linux-64::mkl_random-1.2.2-py311hba01205_0 None
ncurses pkgs/main/linux-64::ncurses-6.4-h6a678d5_0 None
numpy pkgs/main/linux-64::numpy-1.24.3-py311hc206e33_0 None
numpy-base pkgs/main/linux-64::numpy-base-1.24.3-py311hfd5febd_0 None
openssl pkgs/main/linux-64::openssl-1.1.1t-h7f8727e_0 None
pip pkgs/main/linux-64::pip-23.0.1-py311h06a4308_0 None
python pkgs/main/linux-64::python-3.11.3-h7a1cb2a_0 None
readline pkgs/main/linux-64::readline-8.2-h5eee18b_0 None
setuptools pkgs/main/linux-64::setuptools-66.0.0-py311h06a4308_0 None
six pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1 None
sqlite pkgs/main/linux-64::sqlite-3.41.2-h5eee18b_0 None
tk pkgs/main/linux-64::tk-8.6.12-h1ccaba5_0 None
tzdata pkgs/main/noarch::tzdata-2023c-h04d1e81_0 None
wheel pkgs/main/linux-64::wheel-0.38.4-py311h06a4308_0 None
xz pkgs/main/linux-64::xz-5.2.10-h5eee18b_1 None
zlib pkgs/main/linux-64::zlib-1.2.13-h5eee18b_0 None
import numpy
numpy.__file__
'/home/xx/anaconda3/envs/test/lib/python3.11/site-packages/numpy/__init__.py'
解决方法:
以后重建一个python的版本,python3.9。以后都使用python3.9
删除老的环境:
conda env remove -n test
conda env remove -n test2
conda env remove -n test3
conda env remove -n ttseg
conda env remove -n py38base
conda env remove -n py39test
创建ttsegpy39环境
conda create -n ttsegpy39 python=3.9
conda info -e
conda activate ttsegpy39
pip list
接着pip install totalsegmentator
,
安装的库MarkupSafe-2.1.2 PyWavelets-1.4.1 SimpleITK-2.2.1 TotalSegmentator-1.5.5 aiohttp-3.8.4 aiosignal-1.3.1 argparse-1.4.0 async-timeout-4.0.2 attrs-23.1.0 batchgenerators-0.21 certifi-2022.12.7 charset-normalizer-3.1.0 cmake-3.26.3 contourpy-1.0.7 cycler-0.11.0 dataclasses-0.6 dataclasses-json-0.5.7 deprecated-1.2.13 dicom2nifti-2.4.8 dill-0.3.6 filelock-3.12.0 fonttools-4.39.3 frozenlist-1.3.3 fury-0.9.0 future-0.18.3 idna-3.4 imageio-2.28.1 importlib-resources-5.12.0 jinja2-3.1.2 joblib-1.2.0 kiwisolver-1.4.4 lazy_loader-0.2 linecache2-1.0.0 lit-16.0.2 marshmallow-3.19.0 marshmallow-enum-1.5.1 matplotlib-3.7.1 medpy-0.4.0 mpmath-1.3.0 multidict-6.0.4 multiprocess-0.70.14 mypy-extensions-1.0.0 networkx-3.1 nibabel-5.1.0 nnunet-customized-1.2 numpy-1.24.3 nvidia-cublas-cu11-11.10.3.66 nvidia-cuda-cupti-cu11-11.7.101 nvidia-cuda-nvrtc-cu11-11.7.99 nvidia-cuda-runtime-cu11-11.7.99 nvidia-cudnn-cu11-8.5.0.96 nvidia-cufft-cu11-10.9.0.58 nvidia-curand-cu11-10.2.10.91 nvidia-cusolver-cu11-11.4.0.1 nvidia-cusparse-cu11-11.7.4.91 nvidia-nccl-cu11-2.14.3 nvidia-nvtx-cu11-11.7.91 opencv-python-4.7.0.72 p-tqdm-1.4.0 packaging-23.1 pandas-2.0.1 pathos-0.3.0 pillow-9.5.0 pox-0.3.2 ppft-1.7.6.6 psutil-5.9.5 pydicom-2.3.1 pygltflib-1.15.5 pyparsing-3.0.9 python-dateutil-2.8.2 python-gdcm-3.0.21 pytz-2023.3 requests-2.29.0 rt-utils-1.2.7 scikit-image-0.20.0 scikit-learn-1.2.2 scipy-1.9.1 six-1.16.0 sympy-1.11.1 threadpoolctl-3.1.0 tifffile-2023.4.12 torch-2.0.0 tqdm-4.65.0 traceback2-1.4.0 triton-2.0.0 typing-extensions-4.5.0 typing-inspect-0.8.0 tzdata-2023.3 unittest2-1.1.0 urllib3-1.26.15 vtk-9.2.6 wrapt-1.15.0 xvfbwrapper-0.2.9 yarl-1.9.2 zipp-3.15.0
都在'/home/xx/anaconda3/envs/ttsegpy39/lib/python3.9/site-packages
中